Skip to content

Commit 320ef3d

Browse files
committed
Add: load config in processor
1 parent 9e77ad1 commit 320ef3d

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/Processors/AbstractProcessor.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,29 @@
33

44
namespace MonoProcessor\Processors;
55

6-
use Monolog\Logger;
6+
use Monolog\Processor\ProcessorInterface;
77

8-
abstract class AbstractProcessor
8+
abstract class AbstractProcessor implements ProcessorInterface
99
{
10-
private $level;
11-
10+
private $config;
11+
1212
/**
1313
* @param string|int $level The minimum logging level at which this Processor will be triggered
1414
*/
15-
public function __construct($level = Logger::DEBUG)
15+
public function __construct()
1616
{
17-
$this->level = Logger::toMonologLevel($level);
17+
$this->config = $this->getConfig();
1818
}
19-
19+
2020
public function isWrite($level_name)
2121
{
2222
return in_array($level_name, ['ERROR','EMERGENCY']);
2323
}
24+
25+
private function getConfig() : array
26+
{
27+
$config = app()['config']['mono-processor'];
28+
29+
return empty($config) ? [] : $config;
30+
}
2431
}

0 commit comments

Comments
 (0)