Download the PHP package anthonyedmonds/laravel-database-log without Composer
On this page you can find all versions of the php package anthonyedmonds/laravel-database-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anthonyedmonds/laravel-database-log
More information about anthonyedmonds/laravel-database-log
Files in anthonyedmonds/laravel-database-log
Package laravel-database-log
Short Description Store your Laravel logs in the database
License MIT
Homepage https://github.com/AnthonyEdmonds/laravel-database-log
Informations about the package laravel-database-log
Laravel Database Log
Store your Laravel logs in the database!
Installation
-
Add the library using Composer:
-
The service provider will be automatically registered. If required, you can manually register the service provider by adding it to your
bootstrap/providers.php
: -
Publish the database migration and config files using Artisan:
-
Add a log channel to 'config/logging.php' based on the following:
- The
fallback
parameter is optional, and can point to a log to use in case the database cannot be reached. - The
level
parameter can be excluded if desired.
- The
Configuration
The configuration found at config/database-log.php
allows you to customise the following:
Field | Default | Purpose |
---|---|---|
model | AnthonyEdmonds\LaravelDatabaseLog\Log | The class name of the model to use for storing logs in the database |
table | logs | The name of the table used to store database logs |
Cleaning up old logs
Job
A Laravel Job is provided to cleanup old logs.
Add the job to your schedule, providing the number of days after which logs should be deleted.
Command
The database-log:cleanup
command is also provided to remove old logs from the database as required.
You can provide the number of days after which logs should be deleted as part of the command.
You can also schedule the command to run automatically by adding it to your scheduler:
Usage
Whenever Laravel creates a log, whether manually or when exceptions are thrown, a new Log will be created in the database.
You are free to use those Logs in whatever fashion you see fit; no UI or other restrictions are provided by this library.
Issues and feedback
You are welcome to raise issues on Github to provide bug reports, issues, and feedback.