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

LogTracerFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 7
rs 10
c 1
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 4
crap 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