LogHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A write() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Client\FactFinderSdk\Business\Log;
9
10
use Monolog\Handler\AbstractProcessingHandler;
11
use Monolog\Logger;
12
use Psr\Log\LoggerInterface;
13
14
class LogHandler extends AbstractProcessingHandler
15
{
16
    /**
17
     * @var \Psr\Log\LoggerInterface
18
     */
19
    protected $logger;
20
21
    /**
22
     * @param \Psr\Log\LoggerInterface $logger
23
     * @param bool|int $level
24
     * @param bool $bubble
25
     */
26
    public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true)
27
    {
28
        parent::__construct($level, $bubble);
29
30
        $this->logger = $logger;
31
    }
32
33
    /**
34
     * @param array $record
35
     *
36
     * @return void
37
     */
38
    protected function write(array $record): void
39
    {
40
        $this->logger->info($record['message'], $record['context']);
41
    }
42
}
43