TelegrafLogChannel::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 11
ccs 0
cts 9
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\TableSync\Integration\Laravel;
6
7
use Illuminate\Log\LogManager;
8
use Monolog\Logger;
9
use Psr\Log\LoggerInterface;
10
use Umbrellio\TableSync\Monolog\Handler\TelegrafHandler;
11
12
class TelegrafLogChannel extends LogManager
13
{
14
    public function __invoke(array $config): LoggerInterface
15
    {
16
        $handler = new TelegrafHandler(
17
            config('telegraf.host'),
18
            config('telegraf.port'),
19
            $config['measurement'] ?? null,
20
            $config['level'] ?? Logger::INFO,
21
            $config['bubble'] ?? true
22
        );
23
24
        return new Logger($this->parseChannel($config), [$handler]);
25
    }
26
}
27