mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 23:55:35 +08:00
add logging config (#127)
This commit is contained in:
21
config/logging.php
Normal file
21
config/logging.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\LogLevel;
|
||||
use ZM\Logger\ConsoleLogger;
|
||||
|
||||
return [
|
||||
'level' => LogLevel::DEBUG,
|
||||
'logger' => static function (): LoggerInterface {
|
||||
$worker_id = app('worker_id');
|
||||
|
||||
$logger = new ConsoleLogger(zm_config('logging.level'));
|
||||
$logger::$format = "[%date%] [%level%] [#{$worker_id}] %body%";
|
||||
$logger::$date_format = 'Y-m-d H:i:s';
|
||||
// 如果你喜欢旧版的日志格式,请取消下行注释
|
||||
// $logger::$date_format = 'm-d H:i:s';
|
||||
return $logger;
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user