Total Complexity | 3 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
10 | class Logger implements SingletonInterface |
||
11 | { |
||
12 | /** |
||
13 | * @param string $context |
||
14 | * @param Exception $e |
||
|
|||
15 | */ |
||
16 | public function logException($context, \Exception $e) |
||
17 | { |
||
18 | if (true === version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '9.5.0', '<')) { |
||
19 | $this->syslog( |
||
20 | $context, |
||
21 | 'Exception occured ' . PHP_EOL . |
||
22 | ' Code: ' . $e->getCode() . PHP_EOL . |
||
23 | ' Message: "' . $e->getMessage() . '"' . PHP_EOL . |
||
24 | ' Trace:' . PHP_EOL . $e->getTraceAsString(), |
||
25 | 4 |
||
26 | ); |
||
27 | return; |
||
28 | } |
||
29 | |||
30 | $this->logger = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__); |
||
31 | $this->logger->error( |
||
32 | $context . ': ' . $e->getMessage(), |
||
33 | $e->getTrace() |
||
34 | ); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @param string $message |
||
39 | * @param integer $severity |
||
40 | */ |
||
41 | private function syslog($message, $severity) |
||
44 | } |
||
45 | } |