Passed
Pull Request — master (#816)
by butschster
06:49
created

LogTracerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
dl 0
loc 18
rs 10
c 1
b 0
f 0
ccs 4
cts 4
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 3 1
A __construct() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Telemetry;
6
7
use Psr\Log\LoggerInterface;
8
use Spiral\Core\ScopeInterface;
9
use Spiral\Logger\LogsInterface;
10
11
final class LogTracerFactory implements TracerFactoryInterface
12
{
13
    public const LOG_CHANNEL = 'telemetry';
14
15
    private readonly LoggerInterface $logger;
16
17 1
    public function __construct(
18
        private readonly ScopeInterface $scope,
19
        private readonly ClockInterface $clock,
20
        LogsInterface $logs,
21
        string $channel = self::LOG_CHANNEL
22
    ) {
23 1
        $this->logger = $logs->getLogger($channel);
0 ignored issues
show
Bug introduced by
The property logger is declared read-only in Spiral\Telemetry\LogTracerFactory.
Loading history...
24
    }
25
26 1
    public function make(array $context = []): TracerInterface
27
    {
28 1
        return new LogTracer($this->scope, $this->clock, $this->logger);
29
    }
30
}
31