feat: 自定日志处理实现request id

This commit is contained in:
2025-01-18 17:22:03 +08:00
parent 5f7cbf426c
commit 7f58da4e24
4 changed files with 107 additions and 1 deletions

View File

@@ -3,9 +3,12 @@
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
use think\facade\Log;
return [
// 默认日志记录通道
'default' => 'file',
'default' => 'MyFileLogger',
// 日志记录级别
'level' => [],
// 日志类型记录的通道 ['error'=>'email',...]
@@ -39,6 +42,28 @@ return [
// 是否实时写入
'realtime_write' => false,
],
'MyFileLogger' => [
// 日志记录方式
'type' => \app\admin\driver\Logger::class,
// 日志保存目录
'path' => '',
// 单文件日志写入
'single' => false,
// 独立日志级别
'apart_level' => [],
// 最大日志文件数量
'max_files' => 0,
// 使用JSON格式记录
'json' => false,
// 日志处理
'processor' => null,
// 关闭通道日志写入
'close' => false,
// 日志输出格式化
'format' => '[%s][%s][%s] %s',
// 是否实时写入
'realtime_write' => false,
]
// 其它日志通道配置
],