coreproc / laravel-custom-logging
为 AWS CloudWatch 容器提供自定义日志记录
0.2.0
2024-03-25 00:47 UTC
This package is auto-updated.
Last update: 2024-08-25 01:43:28 UTC
README
此包为我们提供了额外的 origin
变量,用于日志以确定日志的来源。
安装
您可以通过 composer 安装此包
composer require coreproc/laravel-custom-logging
发布配置文件
php artisan vendor:publish --provider="Coreproc\LaravelCustomLogging\CustomLoggingServiceProvider"
使用方法
通常,我们在 stderr
通道中使用它。以下是一个配置示例
'channels' => [ 'stderr' => [ 'driver' => 'monolog', 'level' => env('LOG_LEVEL', 'debug'), 'handler' => StreamHandler::class, 'formatter' => Monolog\Formatter\JsonFormatter::class, 'formatter_with' => [ 'includeStacktraces' => true, 'batchMode' => Monolog\Formatter\JsonFormatter::BATCH_MODE_JSON, 'appendNewline' => true, ], 'with' => [ 'stream' => 'php://stderr', ], 'processors' => [\Coreproc\LaravelCustomLogging\AddOriginProcessor::class], ], ],