Download the PHP package cosmastech/laravel-wide-load without Composer
On this page you can find all versions of the php package cosmastech/laravel-wide-load. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cosmastech/laravel-wide-load
More information about cosmastech/laravel-wide-load
Files in cosmastech/laravel-wide-load
Package laravel-wide-load
Short Description Wide event logging for Laravel — one log to rule them all.
License MIT
Informations about the package laravel-wide-load
Wide Load for Laravel
Wide event logging for Laravel — one log line for an entire request, packed with everything that happened.
Instead of scattering dozens of log lines throughout your request lifecycle, Wide Load collects key-value data as your application runs and emits a single, rich log entry when the request, artisan command, or job completes. This is the "wide event" or "canonical log line" pattern. For more details on the benefits of this approach, see loggingsucks.com.
Installation
The package auto-discovers its service provider — no manual registration needed.
Configuration
Publish the config file:
This creates config/wide-load.php with the following options:
| Option | Env Var | Default | Description |
|---|---|---|---|
auto_report |
WIDE_LOAD_AUTO_REPORT |
true |
Toggle for automatic reporting. When false, lifecycle event-driven reporting is skipped. Manual calls to report() still work. |
log_level |
WIDE_LOAD_LOG_LEVEL |
info |
Log level used by the default reporter. |
log_message |
WIDE_LOAD_LOG_MESSAGE |
Request completed. |
Log message used by the default reporter. |
serializable |
WIDE_LOAD_SERIALIZABLE |
true |
Carry wide load data across queued jobs via Laravel's Context serialization. |
Enabling auto-reporting
By default, auto-reporting is enabled. You can disable it globally via the config, or toggle it at runtime on a per-request/job basis:
Since WideLoad is a scoped singleton, the auto-reporting flag resets between requests and queue jobs. This makes it safe to enable reporting in specific services without affecting other jobs processed by the same worker.
Usage
Via the Facade
The quickest way to add data from anywhere in your app:
Automatic reporting
Wide Load automatically calls report() and flush() on:
Terminating(end of HTTP request)CommandFinished(end of Artisan command)JobProcessed(successful queue job)JobFailed(failed queue job)
No manual reporting is needed in most cases if you have auto_report enabled.
Middleware
For more control over HTTP request reporting, you can register the terminable middleware:
When the middleware is registered, it will report and flush during the terminate phase. The Terminating event listener will automatically skip reporting if the middleware has already handled it, so there is no double-reporting.
Custom reporter
By default, Wide Load writes to the Laravel log. To send data somewhere else (a metrics service, a dedicated wide event store, etc.), register a custom callback in your AppServiceProvider:
Events
Wide Load dispatches events during the report() call that you can listen to:
| Event | Description |
|---|---|
WideLoadReporting |
Dispatched when report() is called with data. The event contains the array $data being reported. |
NoWideLoadToReport |
Dispatched when report() is called but there is no data to report. |
License
MIT
All versions of laravel-wide-load with dependencies
illuminate/contracts Version ^12.0 || ^13.0
illuminate/log Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0