LoggerWrap::critical()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Thruster\LoggerWrap;
6
7
use Psr\Log\LoggerInterface;
8
9
/**
10
 * Class LoggerWrap.
11
 *
12
 * @author Aurimas Niekis <[email protected]>
13
 */
14
class LoggerWrap implements LoggerInterface
15
{
16
    /** @var LoggerInterface */
17
    private $logger;
18
19 27
    public function __construct(LoggerInterface $logger = null)
20
    {
21 27
        $this->logger = $logger;
22 27
    }
23
24 3
    public function emergency($message, array $context = []): void
25
    {
26 3
        if (null !== $this->logger) {
27 3
            $this->logger->emergency($message, $context);
28
        }
29 3
    }
30
31 3
    public function alert($message, array $context = []): void
32
    {
33 3
        if (null !== $this->logger) {
34 3
            $this->logger->alert($message, $context);
35
        }
36 3
    }
37
38 3
    public function critical($message, array $context = []): void
39
    {
40 3
        if (null !== $this->logger) {
41 3
            $this->logger->critical($message, $context);
42
        }
43 3
    }
44
45 3
    public function error($message, array $context = []): void
46
    {
47 3
        if (null !== $this->logger) {
48 3
            $this->logger->error($message, $context);
49
        }
50 3
    }
51
52 3
    public function warning($message, array $context = []): void
53
    {
54 3
        if (null !== $this->logger) {
55 3
            $this->logger->warning($message, $context);
56
        }
57 3
    }
58
59 3
    public function notice($message, array $context = []): void
60
    {
61 3
        if (null !== $this->logger) {
62 3
            $this->logger->notice($message, $context);
63
        }
64 3
    }
65
66 3
    public function info($message, array $context = []): void
67
    {
68 3
        if (null !== $this->logger) {
69 3
            $this->logger->info($message, $context);
70
        }
71 3
    }
72
73 3
    public function debug($message, array $context = []): void
74
    {
75 3
        if (null !== $this->logger) {
76 3
            $this->logger->debug($message, $context);
77
        }
78 3
    }
79
80 3
    public function log($level, $message, array $context = []): void
81
    {
82 3
        if (null !== $this->logger) {
83 3
            $this->logger->log($level, $message, $context);
84
        }
85 3
    }
86
}
87