src/log/Logger.php
public static function getLogLevel($class = '') {
        if (!is_string($class)) throw new IllegalTypeException('Illegal type of parameter $class: '.gettype($class));
        self::init();

        // read the configured class specific loglevels
        static $logLevels = null;
        if ($logLevels === null) {
            /** @var ConfigInterface $config */
            $config = self::di('config');

            $logLevels = $config->get('log.level', []);
            if (is_string($logLevels))
                $logLevels = ['' => $logLevels];                            // only the general application loglevel is configured

            foreach ($logLevels as $className => $level) {
                if (!is_string($level)) throw new IllegalTypeException('Illegal configuration value for "log.level.'.$className.'": '.gettype($level));

                if ($level == '') {                                         // classes with empty values fall back to the application loglevel
                    unset($logLevels[$className]);
                }
                else {
                    $logLevel = self::logLevelToId($level);
                    if (!$logLevel) throw new InvalidArgumentException('Invalid configuration value for "log.level.'.$className.'" = '.$level);
                    $logLevels[$className] = $logLevel;

                    if (strStartsWith($className, '\\')) {                  // normalize class names: remove leading back slash
                        unset($logLevels[$className]);
                        $className = substr($className, 1);
                        $logLevels[$className] = $logLevel;
                    }
                }
            }
            $logLevels = \array_change_key_case($logLevels, CASE_LOWER);    // normalize class names: lower-case for case-insensitive look-up
        }

        // look-up the loglevel for the specified class
        $class = strtolower($class);
        if (isset($logLevels[$class]))
            return $logLevels[$class];

        // return the general application loglevel if no class specific loglevel is configured
        return self::$appLogLevel;
    }
public static function getLogLevel($class = '') {
        if (!is_string($class)) throw new IllegalTypeException('Illegal type of parameter $class: '.gettype($class));
        self::init();

        // read the configured class specific loglevels
        static $logLevels = null;
        if ($logLevels === null) {
            /** @var ConfigInterface $config */
            $config = self::di('config');

            $logLevels = $config->get('log.level', []);
            if (is_string($logLevels))
                $logLevels = ['' => $logLevels];                            // only the general application loglevel is configured

            foreach ($logLevels as $className => $level) {
                if (!is_string($level)) throw new IllegalTypeException('Illegal configuration value for "log.level.'.$className.'": '.gettype($level));

                if ($level == '') {                                         // classes with empty values fall back to the application loglevel
                    unset($logLevels[$className]);
                }
                else {
                    $logLevel = self::logLevelToId($level);
                    if (!$logLevel) throw new InvalidArgumentException('Invalid configuration value for "log.level.'.$className.'" = '.$level);
                    $logLevels[$className] = $logLevel;

                    if (strStartsWith($className, '\\')) {                  // normalize class names: remove leading back slash
                        unset($logLevels[$className]);
                        $className = substr($className, 1);
                        $logLevels[$className] = $logLevel;
                    }
                }
            }
            $logLevels = \array_change_key_case($logLevels, CASE_LOWER);    // normalize class names: lower-case for case-insensitive look-up
        }

        // look-up the loglevel for the specified class
        $class = strtolower($class);
        if (isset($logLevels[$class]))
            return $logLevels[$class];

        // return the general application loglevel if no class specific loglevel is configured
        return self::$appLogLevel;
    }
public static function getLogLevel ( $ class = '' ) { if ( ! is_string ( $ class ) ) throw new IllegalTypeException ( 'Illegal type of parameter $class: ' . gettype ( $ class ) ) ; self :: init ( ) ; // read the configured class specific loglevels static $ logLevels = null ; if ( $ logLevels === null ) { /** @var ConfigInterface $config */ $ config = self :: di ( 'config' ) ; $ logLevels = $ config -> get ( 'log.level' , [ ] ) ; if ( is_string ( $ logLevels ) ) $ logLevels = [ '' => $ logLevels ] ; // only the general application loglevel is configured foreach ( $ logLevels as $ className => $ level ) { if ( ! is_string ( $ level ) ) throw new IllegalTypeException ( 'Illegal configuration value for "log.level.' . $ className . '": ' . gettype ( $ level ) ) ; if ( $ level == '' ) { // classes with empty values fall back to the application loglevel unset ( $ logLevels [ $ className ] ) ; } else { $ logLevel = self :: logLevelToId ( $ level ) ; if ( ! $ logLevel ) throw new InvalidArgumentException ( 'Invalid configuration value for "log.level.' . $ className . '" = ' . $ level ) ; $ logLevels [ $ className ] = $ logLevel ; if ( strStartsWith ( $ className , '\\' ) ) { // normalize class names: remove leading back slash unset ( $ logLevels [ $ className ] ) ; $ className = substr ( $ className , 1 ) ; $ logLevels [ $ className ] = $ logLevel ; } } } $ logLevels = \ array_change_key_case ( $ logLevels , CASE_LOWER ) ; // normalize class names: lower-case for case-insensitive look-up } // look-up the loglevel for the specified class $ class = strtolower ( $ class ) ; if ( isset ( $ logLevels [ $ class ] ) ) return $ logLevels [ $ class ] ; // return the general application loglevel if no class specific loglevel is configured return self :: $ appLogLevel ; }
Resolve the loglevel of the specified class.

@param  string $class [optional] - class name

@return int - configured loglevel or the application loglevel if no class specific loglevel is configured
Resolve the loglevel of the specified class .