Get level code by name

@param  string $level level name
@return int
@access public
@throws Exception\InvalidArgumentException
if $throwException and not the right level name
@static
@api
420882
public static function getLevelCode(
        /*# string */ $level
    )/*# : int */ {
        if (is_string($level) &&
            isset(self::$levels[$level])) {
            return self::$levels[$level];
        }

        throw new Exception\InvalidArgumentException(
            Message::get(
                Message::INVALID_LOG_LEVEL,
                (string) $level
            ),
            Message::INVALID_LOG_LEVEL
        );
    }
976833
public static function getLevelDisplayName($level)
    {
        $levels = Monolog::getLevels();
        if (in_array($level, $levels)) {
            $level = array_search($level, $levels);
            switch($level) {
                case 'DEBUG':
                    return tc(/*i18n: Detailed debug information */ 'Log level', 'Debug');
                case 'INFO':
                    return tc(/*i18n: Interesting events */ 'Log level', 'Info');
                case 'NOTICE':
                    return tc(/*i18n: Uncommon events */ 'Log level', 'Notice');
                case 'WARNING':
                    return tc(/*i18n: Exceptional occurrences that are not errors */ 'Log level', 'Warning');
                case 'ERROR':
                    return tc(/*i18n: Runtime errors */ 'Log level', 'Error');
                case 'CRITICAL':
                    return tc(/*i18n: Critical conditions */ 'Log level', 'Critical');
                case 'ALERT':
                    return tc(/*i18n: Action must be taken immediately */ 'Log level', 'Alert');
                case 'EMERGENCY':
                    return tc(/*i18n: Urgent alert */ 'Log level', 'Emergency');
            }
        }
    }
957171
protected static function _getLogLevel( $level = LoggingLevels::INFO, $fullName = false )
    {
        static $_logLevels = null;

        if ( empty( $_logLevels ) )
        {
            $_logLevels = LoggingLevels::getDefinedConstants();
        }

        $_levels = ( is_string( $level ) ? $_logLevels : array_flip( $_logLevels ) );

        if ( null === ( $_tag = Option::get( $_levels, $level ) ) )
        {
            $_tag = 'INFO';
        }

        return ( false === $fullName ? substr( strtoupper( $_tag ), 0, 4 ) : $_tag );
    }
951656
public static function getSecurityLevels(
        string $level = self::INTERACTIVE,
        int $alg = SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13
    ): array {
        switch ($level) {
            case self::INTERACTIVE:
                if ($alg === SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13) {
                    // legacy opslimit and memlimit
                    return [4, 33554432];
                }
                return [
                    \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
                    \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
                ];
            case self::MODERATE:
                if ($alg === SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13) {
                    // legacy opslimit and memlimit
                    return [6, 134217728];
                }
                return [
                    \SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE,
                    \SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE
                ];
            case self::SENSITIVE:
                if ($alg === SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13) {
                    // legacy opslimit and memlimit
                    return [8, 536870912];
                }
                return [
                    \SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE,
                    \SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE
                ];
            default:
                throw new InvalidType(
                    'Invalid security level for Argon2i'
                );
        }
    }
602047
public static function getLevelName($level)
    {
        $level = (int) $level;
        foreach (static::$levelNameToLevel as $levelName => $currentLevel) {
            if ($level >= $currentLevel) {
                return $levelName;
            }
        }

        return static::$levelNameToLevel[static::ALL];
    }
1061437
private function validateLogLevel($level)
    {
        $map = Logger::getLogLevelMap();
        $level = (string) $level;

        if (isset($map[$level]) || isset(array_flip($map)[strtoupper($level)])) {
            return true;
        }

        throw new InvalidArgumentException("Severity level '$level' is not defined.");
    }
606653
public function Level($level)
    {
        $parent = $this;
        $stack = array($parent);
        while ($parent = $parent->Parent) {
            array_unshift($stack, $parent);
        }

        return isset($stack[$level-1]) ? $stack[$level-1] : null;
    }
1036859
protected function _getLevelFromConstant( $level )
	{
		switch( $level )
		{
			case MW_Tree_Manager_Abstract::LEVEL_ONE:
				return 0;
			case MW_Tree_Manager_Abstract::LEVEL_LIST:
				return 1;
			case MW_Tree_Manager_Abstract::LEVEL_TREE:
				return 0x7FFFFFFF; // max. possible level
			default:
				throw new MW_Tree_Exception( sprintf( 'Invalid level constant "%1$d"', $level ) );
		}
	}
188750
public function getParent($level = -1)
    {
        if (-1 === $level) {
            return $this->parent;
        }

        $parents = $this->getParents();

        if ($level < 0) {
            $level = count($parents) + $level;
        }

        return isset($parents[$level]) ? $parents[$level] : null;
    }
982886
public static function getLevel($level = null) {

        $level = strtoupper($level);

        if ( array_key_exists($level, self::$levels) ) return self::$levels[$level];

        return self::$levels[self::DEFAULT_LOG_LEVEL];

    }
1244947
public static function getLevelValue($name)
    {
        $name = strtoupper($name);
        $map = (new \ReflectionClass(self::class))->getConstants();

        return (isset($map[$name]))? $map[$name] : null;
    }
849850
public function logLevel($level)
    {
        if (!is_numeric($level)) {
            return $level;
        }

        try {
            return ucfirst(strtolower(\Monolog\Logger::getLevelName($level)));
        } catch (\Exception $e) {
            return $level;
        }
    }
1231807
public static function getLogger($level = null)
    {
        if (empty($level)) {
            $level = static::DEFAULT_LEVEL;
        }

        if (empty(static::$logger)) {
            static::setLogger($level);
        }

        return static::$logger;
    }
556864
protected function getCallerByLevel($level)
    {
        $level+=1;
        $backtrace=debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, static::MAX_TRACE_LEVEL);
        $caller_class=$backtrace[$level]['class']??'';
        if ($this->dn_class && (is_subclass_of($this->dn_class, $caller_class) || $this->dn_class===$caller_class)) {
            $caller_class=$backtrace[$level+1]['class']??'';
        }
          

        return $caller_class;
    }
778765
public String getNameAt(int level) {
    return this.levelwiseNames[level] instanceof Integer ? this.levelwiseNames[level].toString() : (String) this.levelwiseNames[level];
  }
1300257
public static function getCallerMethod($level = 2)
    {
        $callers = debug_backtrace();

        if (isset($callers[$level]['class'])) {
            $class = $callers[$level]['class'] . '::';
        } else {
            $class = 'function ';
        }

        return $class . $callers[$level]['function'];
    }
79410
public function getFixesForLevel($level)
    {
        if ($level == $this->levels[0]) {
            return array();
        }
        $activated_levels = array();
        for ($i = 1, $c = count($this->levels); $i < $c; $i++) {
            $activated_levels[] = $this->levels[$i];
            if ($this->levels[$i] == $level) {
                break;
            }
        }
        if ($i == $c) {
            trigger_error(
                'Tidy level ' . htmlspecialchars($level) . ' not recognized',
                E_USER_WARNING
            );
            return array();
        }
        $ret = array();
        foreach ($activated_levels as $level) {
            foreach ($this->fixesForLevel[$level] as $fix) {
                $ret[$fix] = true;
            }
        }
        return $ret;
    }