Convert a logging level to its numerical equivalent.

@param level
- the logging level.
@return the numerical index that corresponds to the given level.
511870
@SuppressWarnings({ "checkstyle:magicnumber", "checkstyle:returncount", "checkstyle:npathcomplexity" })
	public static int toInt(Level level) {
		if (level == Level.OFF) {
			return 0;
		}
		if (level == Level.SEVERE) {
			return 1;
		}
		if (level == Level.WARNING) {
			return 2;
		}
		if (level == Level.INFO) {
			return 3;
		}
		if (level == Level.CONFIG) {
			return 4;
		}
		if (level == Level.FINE) {
			return 4;
		}
		if (level == Level.FINER) {
			return 5;
		}
		if (level == Level.FINEST) {
			return 6;
		}
		if (level == Level.ALL) {
			return 7;
		}
		return 3;
	}
237040
protected function normalizeLevel($level)
    {
        if (is_int($level) && array_search($level, self::$levels) !== false) {
            return $level;
        }

        if (is_string($level) && isset(self::$levels[$level])) {
            return self::$levels[$level];
        }

        throw new Exception(
            sprintf("Unknown LogLevel: '%s'", $level)
        );
    }
850319
protected static Event.Level formatLevel(Level level) {
        if (level.isMoreSpecificThan(Level.FATAL)) {
            return Event.Level.FATAL;
        } else if (level.isMoreSpecificThan(Level.ERROR)) {
            return Event.Level.ERROR;
        } else if (level.isMoreSpecificThan(Level.WARN)) {
            return Event.Level.WARNING;
        } else if (level.isMoreSpecificThan(Level.INFO)) {
            return Event.Level.INFO;
        } else {
            return Event.Level.DEBUG;
        }
    }
696525
public static function toMonologLevel($level): int
    {
        if (is_string($level)) {
            if (defined(__CLASS__.'::'.strtoupper($level))) {
                return constant(__CLASS__.'::'.strtoupper($level));
            }

            throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
        }

        return $level;
    }
654320
function level(lvl) {
  if(!lvl) return this._level;
  if(!~LEVELS.indexOf(lvl)) {
    throw new Error('invalid log level: ' + lvl);
  }
  this._level = lvl;
  return this._level;
}
973274
protected Level convertToJDK14Level(LogLevel logLevel) {
    Level level = Level.OFF;
    
    switch(logLevel) {
      case INFO:
        level = Level.INFO;
        break;
      case WARNING:
        level = Level.WARNING;
        break;
      case ERROR:
      case FATAL:
      case SEVERE:
        level = Level.SEVERE;
        break;
    }
    
    return level;
  }
577495
public void setLevel(String logger, Level level) {
      Logger log = getLogger(logger);
      log.setLevel(level);
      for (String loggerName : getLoggerNames()) {
         if (loggerName.startsWith(logger) && !loggerName.equals(logger)) {
            getLogger(loggerName).setLevel(level);
         }
      }
   }
230667
public boolean isLoggable(final Level level) {
        switch (level) {
            case TRACE:
                return isTraceEnabled();
            case DEBUG:
                return isDebugEnabled();
            case INFO:
                return isInfoEnabled();
            case WARN:
                return isWarnEnabled();
            case ERROR:
                return isErrorEnabled();
            default:
                throw new IllegalStateException("Logging level [" + level + "] is invalid");
        }
    }
896972
public double getLevel() {
        final Object value = getInput().get("level");
        if (value instanceof Long) {
            return ((Long) value).doubleValue();
        }
        return (double) value;
    }
1337533
def logging_level(level):
    
    level = level.upper()
    levels = [DEBUG, INFO, WARNING, ERROR, CRITICAL, VERBOSE]
    level_names = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', 'VERBOSE']

    if level not in level_names:
        raise Exception("Level %r not in %r" % (level, levels))

    param_logger = get_logger()
    logging_level = param_logger.getEffectiveLevel()
    param_logger.setLevel(levels[level_names.index(level)])
    try:
        yield None
    finally:
        param_logger.setLevel(logging_level)
821542
private Level toTinyLevel(cn.hutool.log.level.Level level) {
		Level tinyLevel;
		switch (level) {
		case TRACE:
			tinyLevel = Level.TRACE;
			break;
		case DEBUG:
			tinyLevel = Level.DEBUG;
			break;
		case INFO:
			tinyLevel = Level.INFO;
			break;
		case WARN:
			tinyLevel = Level.WARNING;
			break;
		case ERROR:
			tinyLevel = Level.ERROR;
			break;
		case OFF:
			tinyLevel = Level.OFF;
			break;
		default:
			throw new Error(StrUtil.format("Can not identify level: {}", level));
		}
		return tinyLevel;
	}
5841
static Integer getArrayIndex(Map<String,String> meta, int level) {
        return Integer.parseInt(meta.get(level + ARRAY_IDX_SUFFIX));
    }
778765
public String getNameAt(int level) {
    return this.levelwiseNames[level] instanceof Integer ? this.levelwiseNames[level].toString() : (String) this.levelwiseNames[level];
  }
85708
def log_level(self, level):
        
        if 0 <= level <= 7:
            for i in range(level+1):
                self.add_match(PRIORITY="%d" % i)
        else:
            raise ValueError("Log level must be 0 <= level <= 7")
1089831
private static org.tinylog.Level translateLevel(final Level level) {
		switch (level) {
			case TRACE:
				return org.tinylog.Level.TRACE;
			case DEBUG:
				return org.tinylog.Level.DEBUG;
			case INFO:
				return org.tinylog.Level.INFO;
			case WARN:
				return org.tinylog.Level.WARN;
			case ERROR:
			case FATAL:
				return org.tinylog.Level.ERROR;
			default:
				throw new IllegalArgumentException("Unknown JBoss Logging severity level \"" + level + "\"");
		}
	}
541708
def get_loglevel(level):
    
    try:
        return [logging.DEBUG, logging.INFO, logging.WARN][level]
    except IndexError:
        return logging.INFO
436713
def level=(level)
      @logger.level = case level
      when :debug, ::Logger::DEBUG
        Java::org.apache.log4j.Level::DEBUG
      when :info, ::Logger::INFO
        Java::org.apache.log4j.Level::INFO
      when :warn, ::Logger::WARN
        Java::org.apache.log4j.Level::WARN
      when :error, ::Logger::ERROR
        Java::org.apache.log4j.Level::ERROR
      when :fatal, ::Logger::FATAL
        Java::org.apache.log4j.Level::FATAL
      else
        raise NotImplementedError
      end
    end