Custom context
Flare collects a lot of contextual information about your application automatically. On top of that, you can attach your own key/value data so it shows up on every error report, trace, and log Flare receives.
This is especially useful for values that help you triage incidents quickly, like the active tenant, the currently authenticated user role, or a feature flag state.
Adding context
Set custom context items on your Flare client instance:
$flare->context('tenant', 'My-Tenant-Identifier');
The next time an error is reported, a trace is flushed, or a log is sent, this value will be included and available in the "Context" section.
You can also set multiple context items at once:
$flare->context([
'tenant_id' => 'My-Tenant-Identifier',
'tenant_name' => 'My-Tenant-Name',
]);
Custom context is shared across the entire application lifecycle. Once added, it travels with every error report, trace, and log entry collected after the call, until the lifecycle ends or you reset the recorder.
- On this page
- Adding context