ensi/laravel-stdout-logs-helper is a Laravel package for laravel stdout logs helper.
It currently has 1 GitHub stars and 63.886 downloads on Packagist (latest version 1.0.4).
Install it with composer require ensi/laravel-stdout-logs-helper.
Discover more Laravel packages by ensi
or browse all Laravel packages to compare alternatives.
Last updated
Package for duplicating laravel logs in stdout
You can install the package via composer:
composer require ensi/laravel-stdout-logs-helper
| Laravel logs helper | Monolog | Laravel | PHP | |---------------------|----------------|-----------------------------|----------------| | ^0.1.0 | ^2.3 | ^9.0 || ^10.0 || ^11.0 | ^7.3 || ^8.0 | | ^0.2.0 | ^2.3 | ^9.0 || ^10.0 || ^11.0 | ^7.3 || ^8.0 | | ^0.3.0 | ^2.0 || ^3.0 | ^9.0 || ^10.0 || ^11.0 | ^7.3 || ^8.0 | | ^0.4.0 | ^2.0 || ^3.0 | ^9.0 || ^10.0 || ^11.0 | ^8.1 | | ^1.0.0 | ^3.0 | ^10.0 || ^11.0 || ^12.0 | ^8.1 |
Ensi\LaravelStdoutLogsHelper to Ensi\LaravelLogsHelperLaravelStdoutLogsHelper::makeStdoutChannel to LogsConfigMaker::stdoutLaravelStdoutLogsHelper::makeStackChannel to LogsConfigMaker::stackLaravelStdoutLogsHelper::makeDailyChannel to LogsConfigMaker::dailyIn order for the channel to turn into a stack with output to stdout, you must register the stdout_mirror key in the source config
Example:
return LaravelStdoutLogsHelper::addStdoutStacks([
'default' => env('LOG_CHANNEL', 'stack'),
'channels' => [
// manual config
'daily_1' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 14,
'stdout_mirror' => true,
],
// or use our helper
'daily_1' => LogsConfigMaker::daily(storage_path('logs/laravel.log'))
],
]);
Result:
// ...
'channels' => [
'daily_1:original' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 14,
'stdout_mirror' => true,
],
'daily_1:stdout' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stdout',
],
],
'daily_1' => [
'driver' => 'stack',
'name' => 'daily_1',
'channels' => ['daily_1:original', 'daily_1:stdout'],
'ignore_exceptions' => false,
]
],
// ...
For a production environment, it can be important that logs are deleted not by date, but by size.
To set up such rotation, use the DateSizeRotatingFileHandler class. Setting up a channel in logger.php Example:
// ...
'channels' => [
'my:channel' => LogsConfigMaker::dailySize(storage_path('logs/my/channel.log'))
],
// ...
To set up size limits (in bytes) use env:
DateSizeRotatingFileHandler::classFor individual channels, you can redefine the limits using the parameter of the dailySize method.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.