| Conditions | 6 |
| Paths | 7 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 6.0585 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 32 | public function register(Container $container) |
|
| 26 | { |
||
| 27 | 32 | $handlers = config()->get('log', []); |
|
| 28 | 32 | $path = app()->getPath().'/runtime/logs'; |
|
| 29 | |||
| 30 | 32 | foreach ($handlers as $handler) { |
|
| 31 | 32 | list($handle, $name, $level, $format) = array_pad($handler, 4, null); |
|
| 32 | 32 | if (is_string($handle)) { |
|
| 33 | 32 | $handle = new $handle($path.'/'.$name, $level); |
|
| 34 | 32 | } |
|
| 35 | 32 | if ($handle instanceof AbstractHandler) { |
|
| 36 | 32 | if (null === $format) { |
|
| 37 | $format = new LineFormatter(); |
||
| 38 | } |
||
| 39 | 32 | $handle->setFormatter(is_string($format) ? new $format() : $format); |
|
| 40 | 32 | Logger()->pushHandler($handle); |
|
| 41 | 32 | } |
|
| 42 | 32 | } |
|
| 43 | 32 | } |
|
| 44 | } |
||
| 45 |