Completed
Push — master ( 36c7f3...eba0d4 )
by WEBEWEB
01:15
created

TerminalLogger   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A log() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2020 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\Logger;
13
14
use DateTime;
15
use Psr\Log\AbstractLogger;
16
17
/**
18
 * Terminal logger.
19
 *
20
 * @author webeweb <https://github.com/webeweb>
21
 * @package WBW\Library\Core\Logger
22
 */
23
class TerminalLogger extends AbstractLogger {
24
25
    /**
26
     *{@inheritDoc}
27
     */
28
    public function log($level, $message, array $context = []) {
29
        echo vsprintf("[%s] %s: %s, %s\n", [
30
            (new DateTime())->format("Y-m-d h:i:s"),
31
            $level,
32
            $message,
33
            json_encode($context),
34
        ]);
35
    }
36
}