Passed
Push — master ( f6e659...bb9ac5 )
by Patrick
04:00
created

Logger   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 27
rs 10
ccs 0
cts 13
cp 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A info() 0 7 1
A error() 0 7 1
A __construct() 0 2 1
1
<?php
2
3
namespace ForecastAutomation\Log\Business;
4
5
use Psr\Log\LoggerInterface;
6
use Throwable;
7
8
class Logger
9
{
10
    /**
11
     * @param LoggerInterface $logger
12
     */
13
    public function __construct(private LoggerInterface $logger)
14
    {
15
    }
16
17
    public function info(string $message, array $context): void
18
    {
19
        $this->logger->info(
20
            $message,
21
            [
22
                'message' => $message,
23
                'context' => $context,
24
            ]
25
        );
26
    }
27
28
    public function error(string $message, Throwable $e = null): void
29
    {
30
        $this->logger->error(
31
            $message,
32
            [
33
                'message' => $message,
34
                'throwable' => $e,
35
            ]
36
        );
37
    }
38
}
39