Set log level.

    >>> assert get_loglevel(2) == logging.WARN
    >>> assert get_loglevel(10) == logging.INFO
541708
def get_loglevel(level):
    
    try:
        return [logging.DEBUG, logging.INFO, logging.WARN][level]
    except IndexError:
        return logging.INFO
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;
}
457808
def get_logging_level(debug):
    """"""
    level = logging.INFO
    if debug:
        level = logging.DEBUG
    return level
1312554
public static void setLoggingLevel(final Level level) {
    final Handler[] handlers = Logger.getLogger("").getHandlers();
    ConsoleHandler ch = null;
    for (final Handler h : handlers) {
      if (h instanceof ConsoleHandler) {
        ch = (ConsoleHandler) h;
        break;
      }
    }
    if (ch == null) {
      ch = new ConsoleHandler();
      Logger.getLogger("").addHandler(ch);
    }
    ch.setLevel(level);
    Logger.getLogger("").setLevel(level);
  }
1250228
def set_level(level):
        
        Logger.level = level
        for logger in Logger.loggers.values():
            logger.setLevel(level)
115204
def set_loglevel(level: Union[int, str, None] = None) -> None:
    
    if level is not None:
        lv = level_to_int(level)
    elif config.logging:
        lv = level_to_int(config.logging)
    elif config.debug:
        lv = logging.DEBUG
    else:
        lv = logging.INFO
    root_logger.setLevel(lv)
    _log_handler.setLevel(lv)
454399
def configure_logging(level):
    

    global logging_level
    logging_level = logging.ERROR
    if "info" == level.lower():
        logging_level = logging.INFO
    elif "warn" == level.lower():
        logging_level = logging.WARNING
    elif "debug" == level.lower():
        logging_level = logging.DEBUG
329873
def log(self, level, *args, **kwargs):
        
        target = getattr(self.__logger, level)
        target(*args, **kwargs)
460702
def set_log_level(level=nil)
      defined?(Rails) and (default = (Rails.env.production? ? "INFO" : "DEBUG")) or (default = "INFO")
      log_level = (ENV['LOG_LEVEL'] || level || default)
      self.level = ZTK::Logger.const_get(log_level.to_s.upcase)
    end
768384
def _set_debug_level(self, debug_level):
    
    mapping = {
        0: logging.ERROR,
        1: logging.INFO,
        2: logging.DEBUG,
    }

    self.setLevel(
        mapping[min(debug_level, 2)],
    )
856948
public static void setLogLevel(String cls, String level){
        Logger l = null;
        if(Objects.isNullOrEmpty(cls))
            l = LogManager.getRootLogger();
        else
            l = LogManager.getLogger(cls);
        if(level.equalsIgnoreCase("TRACE"))
            l.setLevel(Level.TRACE);
        else if(level.equalsIgnoreCase("DEBUG"))
            l.setLevel(Level.DEBUG);
        else if(level.equalsIgnoreCase("INFO"))
            l.setLevel(Level.INFO);
        else if(level.equalsIgnoreCase("WARN"))
            l.setLevel(Level.WARN);
        else if(level.equalsIgnoreCase("ERROR"))
            l.setLevel(Level.ERROR);
    }
624905
function setLevel(level) {
    opts.level = level;
    let logLevelIndex = levels.indexOf(opts.level.toUpperCase());

    levels.forEach((logLevel) => {
      let fn;
      if (logLevelIndex <= levels.indexOf(logLevel)) {
        fn = logWrap(logLevel);
      } else {
        fn = noop;
      }
      API[logLevel.toLowerCase()] = fn;
    });
  }
998212
def init_log(log_level):
    """"""
    log_level = log_level or "INFO"
    logging.basicConfig(
        format="%(name)s:%(levelname)s:%(message)s",
        level=getattr(logging, log_level.upper(), logging.INFO),
    )
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;
    }
950690
def set_log_level(level):
    
    from .._connect import main as _glconnect
    unity = _glconnect.get_unity()
    return unity.set_log_level(level)
242509
def set_loglevel(self, level):
        
        self.log_level = level
        log_manager.config_stdio(default_level=level)
284841
public static LogInfo setLogLevel(String logName, String level) throws IOException {
    LogInfo result = new LogInfo();
    if (StringUtils.isNotBlank(logName)) {
      result.setLogName(logName);
      Log log = LogFactory.getLog(logName);
      Logger logger = LoggerFactory.getLogger(logName);
      if (log instanceof Log4JLogger) {
        process(((Log4JLogger) log).getLogger(), level, result);
      } else if (log instanceof Jdk14Logger) {
        process(((Jdk14Logger) log).getLogger(), level, result);
      } else if (logger instanceof Log4jLoggerAdapter) {
        try {
          Field field = Log4jLoggerAdapter.class.getDeclaredField("logger");
          field.setAccessible(true);
          org.apache.log4j.Logger log4jLogger = (org.apache.log4j.Logger) field.get(logger);
          process(log4jLogger, level, result);
        } catch (NoSuchFieldException | IllegalAccessException e) {
          result.setMessage(e.getMessage());
        }
      } else {
        result.setMessage("Sorry, " + log.getClass() + " not supported.");
      }
    } else {
      result.setMessage("Please specify a correct logName.");
    }
    return result;
  }