joy2fun / laravel-log-pub
此包的最新版本(0.1.1)没有提供许可证信息。
为 Laravel 将日志记录到 Redis 通道。
0.1.1
2018-10-11 05:43 UTC
Requires (Dev)
- laravel/laravel: ^5.6
- mockery/mockery: ^1.2
- phpunit/phpunit: ^7.4
This package is auto-updated.
Last update: 2024-09-11 21:43:02 UTC
README
安装
composer require joy2fun/laravel-log-pub
配置
将自定义日志通道添加到 config/logging.php
'pub' => [
'driver' => 'custom',
'via' => \Joy2fun\RedisPubLogger\Logger::class
],
记录到配置的通道
Log::channel("pub")->debug("dummy");
订阅 Redis 通道
php artisan redis:subscribe
更多选项
[
// ...
'pub' => [
'driver' => 'custom',
'via' => \Joy2fun\RedisPubLogger\Logger::class,
'with' => [
'connection' => 'default', // redis connection
'quiet' => false, // "true" to ignore redis connection exception. default is "false"
'max_trace_length' => 1024, // truncated stacktrace string. set it to "0" to exclude trace from log
'format' => "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n",
]
]
]