InfluxDBLogChannel::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 8
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 InfluxDB\Database;
9
use Monolog\Logger;
10
use Psr\Log\LoggerInterface;
11
use Umbrellio\TableSync\Monolog\Handler\InfluxDBHandler;
12
13
class InfluxDBLogChannel extends LogManager
14
{
15
    public function __invoke(array $config): LoggerInterface
16
    {
17
        $handler = new InfluxDBHandler(
18
            $this->app->make(Database::class),
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