Passed
Push — master ( 46ff7d...5b3b8d )
by Dan Michael O.
04:19
created

DatabaseLoggingHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 6
rs 10
1
<?php
2
3
namespace App\Logging;
4
5
use App\LogEntry;
0 ignored issues
show
Bug introduced by
The type App\LogEntry was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Support\Arr;
7
use Monolog\Handler\AbstractProcessingHandler;
8
9
class DatabaseLoggingHandler extends AbstractProcessingHandler
10
{
11
    protected function write(array $record)
12
    {
13
        LogEntry::create([
14
            'channel'    => Arr::get($record, 'channel'),
15
            'message'    => Arr::get($record, 'message'),
16
            'level'      => Arr::get($record, 'level'),
17
            'level_name' => Arr::get($record, 'level_name'),
18
            'context'    => $record['context'],
19
            // 'extra'      => json_encode($record['extra']),
20
            'time'   => $record['datetime']->format('Y-m-d G:i:s'),
21
        ]);
22
    }
23
}
24