/** * Initialize, load config and etc. */ private static function init() { if (static::$writers === null) { static::$writers = array(); $configs = Application::getConfig('application', 'log'); $count = 0; foreach ($configs as $config) { if ($config['enabled']) { // if the config is enabled, then make new instance $writer = $config['writer_class']; static::$writers[$count] = new $writer($config['options']); if (!static::$writers[$count] instanceof AbstractLogWriter) { throw new Exception("Log driver {$writer} must extend AbstractLogWriter"); } $count++; } } register_shutdown_function(function () { \Koldy\Log::shutdown(); }); } }