Completed
Push — master ( 150272...5e1cd2 )
by Matze
14:28 queued 09:42
created

LoggerTrait::log()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
rs 10
ccs 3
cts 3
cp 1
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php
2
3
namespace BrainExe\Core\Traits;
4
5
use BrainExe\Annotations\Annotations\Inject;
6
use Monolog\Logger;
7
8
/**
9
 * @api
10
 */
11
trait LoggerTrait
12
{
13
14
    use \Psr\Log\LoggerTrait;
15
16
    /**
17
     * @var Logger
18
     */
19
    private $logger;
20
21
    /**
22
     * @Inject("@logger")
23
     * @param Logger $logger
24
     */
25 5
    public function setLogger(Logger $logger)
26
    {
27 5
        $this->logger = $logger;
28 5
    }
29
30
    /**
31
     * Logs with an arbitrary level.
32
     *
33
     * @param mixed $level
34
     * @param string $message
35
     * @param array $context
36
     */
37 3
    public function log($level, $message, array $context = [])
38
    {
39 3
        $this->logger->log($level, $message, $context);
40 3
    }
41
}
42