src/Koldy/Log.php
public static function init(): void
    {
        if (static::$adapters === null) {
        	static::$randomNumber = rand(100000, 999999);

        	// set the "who"
            static::resetWho();

            static::$adapters = [];
            $configs = Application::getConfig('application')->get('log', []);

            $count = 0;
            foreach ($configs as $index => $config) {
                $enabled = $config['enabled'] && is_array($config['options']['log']) && count($config['options']['log']) > 0;

                // TODO: Register module if needed

                if ($enabled) {
                    if (!isset($config['adapter_class'])) {
                        throw new ConfigException("Logger[{$index}] defined in application config is missing adapter_class key");
                    }

                    // if the config is enabled, then make new instance
                    $adapter = $config['adapter_class'];

                    static::$adapters[$count] = new $adapter($config['options']);

                    // Log class must be instance of AbstractLogAdapter
                    if (!(static::$adapters[$count] instanceof AbstractLogAdapter)) {
                        throw new Exception("Log adapter {$adapter} must extend AbstractLogAdapter");
                    }

                    static::$enabledAdapters[$config['adapter_class']] = true;

                    foreach ($config['options']['log'] as $level) {
                        static::$enabledLevels[$level] = true;
                    }

                    $count++;
                }
            }
        }
    }
public static function init(): void
    {
        if (static::$adapters === null) {
        	static::$randomNumber = rand(100000, 999999);

        	// set the "who"
            static::resetWho();

            static::$adapters = [];
            $configs = Application::getConfig('application')->get('log', []);

            $count = 0;
            foreach ($configs as $index => $config) {
                $enabled = $config['enabled'] && is_array($config['options']['log']) && count($config['options']['log']) > 0;

                // TODO: Register module if needed

                if ($enabled) {
                    if (!isset($config['adapter_class'])) {
                        throw new ConfigException("Logger[{$index}] defined in application config is missing adapter_class key");
                    }

                    // if the config is enabled, then make new instance
                    $adapter = $config['adapter_class'];

                    static::$adapters[$count] = new $adapter($config['options']);

                    // Log class must be instance of AbstractLogAdapter
                    if (!(static::$adapters[$count] instanceof AbstractLogAdapter)) {
                        throw new Exception("Log adapter {$adapter} must extend AbstractLogAdapter");
                    }

                    static::$enabledAdapters[$config['adapter_class']] = true;

                    foreach ($config['options']['log'] as $level) {
                        static::$enabledLevels[$level] = true;
                    }

                    $count++;
                }
            }
        }
    }
public static function init ( ) : void { if ( static :: $ adapters === null ) { static :: $ randomNumber = rand ( 100000 , 999999 ) ; // set the "who" static :: resetWho ( ) ; static :: $ adapters = [ ] ; $ configs = Application :: getConfig ( 'application' ) -> get ( 'log' , [ ] ) ; $ count = 0 ; foreach ( $ configs as $ index => $ config ) { $ enabled = $ config [ 'enabled' ] && is_array ( $ config [ 'options' ] [ 'log' ] ) && count ( $ config [ 'options' ] [ 'log' ] ) > 0 ; // TODO: Register module if needed if ( $ enabled ) { if ( ! isset ( $ config [ 'adapter_class' ] ) ) { throw new ConfigException ( "Logger[{$index}] defined in application config is missing adapter_class key" ) ; } // if the config is enabled, then make new instance $ adapter = $ config [ 'adapter_class' ] ; static :: $ adapters [ $ count ] = new $ adapter ( $ config [ 'options' ] ) ; // Log class must be instance of AbstractLogAdapter if ( ! ( static :: $ adapters [ $ count ] instanceof AbstractLogAdapter ) ) { throw new Exception ( "Log adapter {$adapter} must extend AbstractLogAdapter" ) ; } static :: $ enabledAdapters [ $ config [ 'adapter_class' ] ] = true ; foreach ( $ config [ 'options' ] [ 'log' ] as $ level ) { static :: $ enabledLevels [ $ level ] = true ; } $ count ++ ; } } } }
Initialize, load config and etc.
@throws Exception
Initialize load config and etc .