Passed
Push — master ( b5e6ba...9ab7d8 )
by Radu
09:39 queued 02:23
created

LogTrait::logInfo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WebServCo\Framework\Traits;
6
7
/**
8
* Log simple messages to both file and output.
9
*/
10
trait LogTrait
11
{
12
    protected \WebServCo\Framework\Interfaces\LoggerInterface $fileLogger;
13
    protected \WebServCo\Framework\Interfaces\OutputLoggerInterface $outputLogger;
14
15
    /**
16
    * @param mixed $context
17
    */
18
    protected function logDebug(string $message, $context = []): void
19
    {
20
        $this->outputLogger->debug($message);
21
        $this->fileLogger->debug($message, $context);
22
    }
23
24
    /**
25
    * @param mixed $context
26
    */
27
    protected function logError(string $message, $context = []): void
28
    {
29
        $this->outputLogger->output($message);
30
31
        $this->fileLogger->error($message, $context);
32
    }
33
34
    /**
35
    * @param mixed $context
36
    */
37
    protected function logInfo(string $message, $context = []): void
38
    {
39
        $this->outputLogger->info($message);
40
        $this->fileLogger->info($message, $context);
41
    }
42
43
    /**
44
    * @param mixed $context
45
    */
46
    protected function logWarning(string $message, $context = []): void
47
    {
48
        $this->outputLogger->warning($message);
49
        $this->fileLogger->warning($message, $context);
50
    }
51
}
52