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

TerminalLogger::log()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
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
}