Conditions | 4 |
Paths | 8 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
20 | 136 | public function __invoke(ContainerInterface $container) |
|
21 | { |
||
22 | 136 | $config = $container->has('config') ? $container->get('config') : []; |
|
23 | 136 | $loggerConfig = $config['logger'] ?? []; |
|
24 | |||
25 | 136 | $logger = new Logger('app'); |
|
26 | |||
27 | 136 | if (!empty($loggerConfig)) { |
|
28 | 136 | $this->addHandlers($logger, $loggerConfig, $container); |
|
29 | } |
||
30 | |||
31 | 136 | if (!$logger->getHandlers()) { |
|
32 | // add default handler |
||
33 | 2 | $baseHandler = new StreamHandler('data/log/app.log'); |
|
34 | 2 | $logger->pushHandler($baseHandler); |
|
35 | } |
||
36 | |||
37 | 136 | return $logger; |
|
38 | } |
||
39 | |||
54 |