| Total Complexity | 8 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | trait LogTrait |
||
| 13 | { |
||
| 14 | protected \WebServCo\Framework\Interfaces\LoggerInterface $fileLogger; |
||
| 15 | protected ?OutputLoggerInterface $outputLogger = null; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param mixed $context |
||
| 19 | */ |
||
| 20 | protected function logDebug(string $message, $context = []): void |
||
| 21 | { |
||
| 22 | $this->fileLogger->debug($message, $context); |
||
| 23 | if (!$this->outputLogger instanceof OutputLoggerInterface) { |
||
| 24 | return; |
||
| 25 | } |
||
| 26 | $this->outputLogger->output($message); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param mixed $context |
||
| 31 | */ |
||
| 32 | protected function logError(string $message, $context = []): void |
||
| 33 | { |
||
| 34 | $this->fileLogger->error($message, $context); |
||
| 35 | if (!$this->outputLogger instanceof OutputLoggerInterface) { |
||
| 36 | return; |
||
| 37 | } |
||
| 38 | $this->outputLogger->output($message); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param mixed $context |
||
| 43 | */ |
||
| 44 | protected function logInfo(string $message, $context = []): void |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param mixed $context |
||
| 55 | */ |
||
| 56 | protected function logWarning(string $message, $context = []): void |
||
| 63 | } |
||
| 64 | } |
||
| 65 |