| Conditions | 5 |
| Paths | 1 |
| Total Lines | 26 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function register(Container $pimple) |
||
| 27 | { |
||
| 28 | $pimple['logger'] = $pimple['log'] = function ($app) { |
||
| 29 | $config = $this->formatLogConfig($app); |
||
| 30 | |||
| 31 | if (!empty($config)) { |
||
| 32 | $app['config']->merge($config); |
||
| 33 | } |
||
| 34 | |||
| 35 | $log = new LogManager($app); |
||
| 36 | |||
| 37 | if (defined('PHPUNIT_RUNNING') || 'cli' === php_sapi_name()) { |
||
| 38 | if (Arr::get($config, 'cli_on', false)) { |
||
| 39 | $log->setDefaultDriver('errorlog') |
||
| 40 | ->addChannels([ |
||
| 41 | 'errorlog' => [ |
||
| 42 | 'driver' => 'errorlog', |
||
| 43 | 'level' => 'info', |
||
| 44 | ], |
||
| 45 | ]); |
||
| 46 | } else { |
||
| 47 | $log->driver()->pushHandler(new NullHandler()); |
||
|
|
|||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | return $log; |
||
| 52 | }; |
||
| 100 |