TelegrafLogChannel   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 1
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