Logger   A
last analyzed

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 __construct() 0 2 1
A info() 0 7 1
A error() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of forecast.it.fill project.
7
 * (c) Patrick Jaja <[email protected]>
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace ForecastAutomation\Log\Business;
13
14
use Psr\Log\LoggerInterface;
15
use Throwable;
16
17
class Logger
18
{
19
    /**
20
     * @param LoggerInterface $logger
21
     */
22
    public function __construct(private LoggerInterface $logger)
23
    {
24
    }
25
26
    public function info(string $message, array $context): void
27
    {
28
        $this->logger->info(
29
            $message,
30
            [
31
                'message' => $message,
32
                'context' => $context,
33
            ]
34
        );
35
    }
36
37
    public function error(string $message, Throwable $e = null): void
38
    {
39
        $this->logger->error(
40
            $message,
41
            [
42
                'message' => $message,
43
                'throwable' => $e,
44
            ]
45
        );
46
    }
47
}
48