Download the PHP package adamcrampton/laravel-database-logger without Composer
On this page you can find all versions of the php package adamcrampton/laravel-database-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adamcrampton/laravel-database-logger
More information about adamcrampton/laravel-database-logger
Files in adamcrampton/laravel-database-logger
Package laravel-database-logger
Short Description Write Laravel logs to database table via Eloquent model
License MIT
Informations about the package laravel-database-logger
laravel-database-logger
Laravel logs to database table via custom Monolog channel + Eloquent model.
Installation
- Run in your project directory
- Add library service provider to
- Run to set up the table
-
In , add a new channel for the custom logs:
- Update the log stack array in to include the new channel:
Configuration
A scheduled task is bundled with the package, which will delete rows in the table older than the expiration setting. To use this:
- Run to publish the config file to your project
- Run to ensure the project config is up to date
- Set the expiration length (in days) in your project's file
- Add an entry to the file to schedule the cron job, something like:
To run the command manually:
Usage
The package is pretty much a custom channel for Monolog, so you can use the existing facade and methods.
These columns are automatically populated when adding to the log:
- The log message
- The origin value from the request header
- Log type (, , , or )
- Log result (, , or )
- Log message level (, , , , , , , or )
Additionally, you can pass in a and value, which will be saved to those columns when generating a log entry. Example: