| Conditions | 3 |
| Paths | 3 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 31 | 6 | public static function getLogger(LogTypeEnum $type): Logger |
|
| 32 | { |
||
| 33 | 6 | if (!array_key_exists($type->value, self::$loggers)) { |
|
| 34 | |||
| 35 | 2 | $logPath = $type->getLogfilePath(Init::getContainer()->get(StuConfigInterface::class) |
|
| 36 | 2 | ->getDebugSettings()->getLoggingSettings()->getLogDirectory()); |
|
| 37 | |||
| 38 | 2 | $logger = new Logger($type->value); |
|
| 39 | |||
| 40 | 2 | if ($type->isRotating()) { |
|
| 41 | 2 | $logger->pushHandler( |
|
| 42 | 2 | new RotatingFileHandler($logPath, 10, Level::Info) |
|
| 43 | 2 | ); |
|
| 44 | } else { |
||
| 45 | 1 | $logger->pushHandler( |
|
| 46 | 1 | new StreamHandler( |
|
| 47 | 1 | $logPath |
|
| 48 | 1 | ), |
|
| 49 | 1 | ); |
|
| 50 | } |
||
| 51 | |||
| 52 | 2 | self::$loggers[$type->value] = $logger; |
|
| 53 | } |
||
| 54 | |||
| 55 | 6 | return self::$loggers[$type->value]; |
|
| 56 | } |
||
| 58 |