andrey-helldar / laravel-logger-channels
Set of custom loggers for Monolog in Laravel
Fund package maintenance!
Boosty
Yoomoney
Donationalerts
Requires
- php: ^7.1.3|^8.0
- monolog/monolog: ^2.0
README
Set of custom loggers for Monolog in Laravel.
Installation
To get the latest version of Laravel Logger Channels
, simply require the project using Composer:
$ composer require andrey-helldar/laravel-logger-channels
This command will automatically install the latest version of the package for your environment.
Instead, you may of course manually update your require
block and run composer update
if you so choose:
{ "require": { "andrey-helldar/laravel-logger-channels": "^1.2" } }
Using
There are two methods for using custom loggers - calling a class with a settings preset or manually setting a logger.
Processes Rotation
Add a new channel in file config/logging.php
or modify an existing one using one of the following methods:
use Helldar\LaravelLoggerChannels\Loggers\ProcessesRotation\DifferentLogsChannel; return [ 'channels' => [ 'your_channel' => DifferentLogsChannel::get( storage_path('logs/your-filename.log') ) ] ];
use Helldar\LaravelLoggerChannels\Loggers\Common\LogFormatter; use Helldar\LaravelLoggerChannels\Loggers\ProcessesRotation\Logger; return [ 'channels' => [ 'your_channel' => [ 'driver' => 'custom', 'via' => Logger::class, 'tap' => [LogFormatter::class], 'path' => storage_path('logs/your-filename.log'), 'days' => 7, ] ] ];
In each case, one log file will be created for one session. The session label is taken from the global variable LARAVEL_START
.
License
This package is licensed under the MIT License.
For Enterprise
Available as part of the Tidelift Subscription.
The maintainers of andrey-helldar/laravel-logger-channels
and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. Learn more.