Return the name of a log level.
    @param level: The level we want to know the name
    @type level: int
    @return: The name of the level
    @rtype: str
175705
def getLevelName(level):
    
    assert isinstance(level, int) and level > 0 and level < 6, \
           TypeError("Bad debug level")
    return getLevelNames()[level - 1]
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];

    }
1168869
protected static int getLevel(String level, int defaultLogLevel) {
        try {
            return Integer.parseInt(level);
        } catch (NumberFormatException e) {
            // Try to read the string.
            if ("VERBOSE".equalsIgnoreCase(level)) {
                return Constants.VERBOSE;
            } else if ("DEBUG".equalsIgnoreCase(level)) {
                return Constants.DEBUG;
            } else if ("INFO".equalsIgnoreCase(level)) {
                return Constants.INFO;
            } else if ("WARN".equalsIgnoreCase(level)) {
                return Constants.WARN;
            } else if ("ERROR".equalsIgnoreCase(level)) {
                return Constants.ERROR;
            } else if ("ASSERT".equalsIgnoreCase(level)) {
                return Constants.ASSERT;
            }
        }

        return defaultLogLevel;
    }
1355796
def get_loglevel(level):
    
    if level == 'debug':
        return logging.DEBUG
    elif level == 'notice':
        return logging.INFO
    elif level == 'info':
        return logging.INFO
    elif level == 'warning' or level == 'warn':
        return logging.WARNING
    elif level == 'error' or level == 'err':
        return logging.ERROR
    elif level == 'critical' or level == 'crit':
        return logging.CRITICAL
    elif level == 'alert':
        return logging.CRITICAL
    elif level == 'emergency' or level == 'emerg':
        return logging.CRITICAL
    else:
        return logging.INFO
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);
         }
      }
   }
347044
def tablename(self) -> str:
        
        if self._tablename:
            return self._tablename
        return self.table.name
778765
public String getNameAt(int level) {
    return this.levelwiseNames[level] instanceof Integer ? this.levelwiseNames[level].toString() : (String) this.levelwiseNames[level];
  }
1029526
def log_level=(level)
      if level.is_a?(Integer)
        @logger.level = level
      else
        @logger.level = Logger.const_get(level.to_s.upcase)
      end
    end
1310355
@VisibleForTesting
  static Level getLogLevel(Throwable t) {
    if (t instanceof IOException && t.getMessage() != null) {
      for (String msg : QUIET_ERRORS) {
        if (t.getMessage().equals(msg)) {
          return Level.FINE;
        }
      }
    }
    return Level.INFO;
  }
184150
@Nullable
    public String getLoggerLevel(@Nullable String loggerName) {
        try {
            loggerName = loggerName == null ? "" : loggerName;
            if (loggerName.isEmpty()) {
                return LogManager.getRootLogger().getLevel().toString();
            }

            Logger logger = LogManager.exists(loggerName);
            if (logger == null) {
                return null;
            } else {
                Level level = logger.getLevel();
                if (level == null) {
                    return null;
                }
                return level.toString();
            }
        } catch (RuntimeException e) {
            logger.warn("Exception getting effective logger level " + loggerName, e);
            throw e;
        }
    }
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)
541708
def get_loglevel(level):
    
    try:
        return [logging.DEBUG, logging.INFO, logging.WARN][level]
    except IndexError:
        return logging.INFO
507873
def set_level(name, level):
    
    if name is None or name == "" or name == "bench":
        logging.getLogger("bench").setLevel(level)
    loggername = "bench." + name
    logging.getLogger(loggername).setLevel(level)
1309529
def getLogLevelNo(level):
    """"""
    if isinstance(level,(int,long)):
        return level
    try:
        return(int(logging.getLevelName(level.upper())))
    except:
        raise ValueError('illegal loglevel %s' % level)
1005319
def log_level(io_handler, level=None, name=None):
        
        # Get the logger
        logger = logging.getLogger(name)

        # Normalize the name
        if not name:
            name = "Root"

        if not level:
            # Level not given: print the logger level
            io_handler.write_line(
                "{0} log level: {1} (real: {2})",
                name,
                logging.getLevelName(logger.getEffectiveLevel()),
                logging.getLevelName(logger.level),
            )
        else:
            # Set the logger level
            try:
                logger.setLevel(level.upper())
                io_handler.write_line("New level for {0}: {1}", name, level)
            except ValueError:
                io_handler.write_line("Invalid log level: {0}", level)
1180987
public static String logLevelToString(final int level) {
        String logLevel;
        switch (level) {
            case Project.MSG_DEBUG:
                logLevel = "DEBUG";
                break;
            case Project.MSG_VERBOSE:
                logLevel = "VERBOSE";
                break;
            case Project.MSG_INFO:
                logLevel = "INFO";
                break;
            case Project.MSG_WARN:
                logLevel = "WARN";
                break;
            case Project.MSG_ERR:
                logLevel = "ERROR";
                break;
            default:
                logLevel = "UNKNOWN";
                break;
        }
        return logLevel;

    }
1368254
def level(self) -> str:
        
        levels = self._data['level']
        return self.random.choice(levels)