-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMixMode.php
More file actions
38 lines (33 loc) · 929 Bytes
/
MixMode.php
File metadata and controls
38 lines (33 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace WebmanTech\Logger\Mode;
use Monolog\Handler\RotatingFileHandler;
use function WebmanTech\CommonUtils\runtime_path;
class MixMode extends BaseMode
{
/**
* @var array
*/
protected $config = [
'max_files' => 30,
'name' => 'channelMixed', // 合并时的日志文件名
];
/**
* @inheritDoc
*/
public function getHandler(string $channelName, string $level): array
{
if (!$this->checkHandlerUsefulForChannel($channelName)) {
return [];
}
$name = $this->config['name'];
return [
'class' => RotatingFileHandler::class,
'constructor' => [
'filename' => runtime_path("logs/{$name}/{$name}.log"),
'maxFiles' => $this->config['max_files'],
'level' => $level,
],
'formatter' => $this->getFormatter(),
];
}
}