Passed
Push — master ( d47bdf...6296de )
by Kirill
03:33
created

NullLogger::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Logger;
13
14
use Psr\Log\LoggerInterface;
15
use Psr\Log\LoggerTrait;
16
17
/**
18
 * Simply forwards debug messages into various locations.
19
 */
20
final class NullLogger implements LoggerInterface
21
{
22
    use LoggerTrait;
23
24
    /** @var callable */
25
    private $receptor;
26
27
    /** @var string */
28
    private $channel;
29
30
    /**
31
     * @param callable $receptor
32
     * @param string   $channel
33
     */
34
    public function __construct(callable $receptor, string $channel)
35
    {
36
        $this->receptor = $receptor;
37
        $this->channel = $channel;
38
    }
39
40
    /**
41
     * @param mixed  $level
42
     * @param string $message
43
     * @param array  $context
44
     */
45
    public function log($level, $message, array $context = []): void
46
    {
47
        call_user_func($this->receptor, $this->channel, $level, $message, $context);
48
    }
49
}
50