Translates a {@code java.util.logging} level into a tinylog severity level.

@param level
Logging level from {@code java.util.logging}
@return Severity level for tinylog
435979
private static org.tinylog.Level translateLevel(final Level level) {
		if (level.intValue() <= Level.FINEST.intValue()) {
			return org.tinylog.Level.TRACE;
		} else if (level.intValue() <= Level.FINE.intValue()) {
			return org.tinylog.Level.DEBUG;
		} else if (level.intValue() <= Level.INFO.intValue()) {
			return org.tinylog.Level.INFO;
		} else if (level.intValue() <= Level.WARNING.intValue()) {
			return org.tinylog.Level.WARN;
		} else {
			return org.tinylog.Level.ERROR;
		}
	}
607941
public Level tango_to_log4j_level(String level)
  {
   level = level.toUpperCase();
   if (level.equals(LOGGING_LEVELS[LOGGING_OFF])) {
     return Level.OFF;
   }
   if (level.equals(LOGGING_LEVELS[LOGGING_FATAL])) {
     return Level.FATAL;
   }
   if (level.equals(LOGGING_LEVELS[LOGGING_ERROR])) {
     return Level.ERROR;
   }
   if (level.equals(LOGGING_LEVELS[LOGGING_INFO])) {
     return Level.INFO;
   }
   if (level.equals(LOGGING_LEVELS[LOGGING_DEBUG])) {
     return Level.DEBUG;
   }
   return Level.WARN;
  }
227772
private Level getLogLevel() {
        return isQuiet() ? Level.OFF : isVerbose() ? Level.DEBUG : Level.INFO;
    }
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;

    }
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);
         }
      }
   }
1286627
public boolean setLevel(String level) {
        boolean isSucceed = true;
        try {
            LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
            loggerContext.getLogger("root").setLevel(Level.valueOf(level));
        } catch (Exception e) {
            e.printStackTrace();
            isSucceed = false;
        }
        return isSucceed;
    }
599950
public static boolean log(Level level, Throwable t, String format, Object... arguments) {
		return log(LogFactory.indirectGet(), level, t, format, arguments);
	}
1354548
public String getLoggerLevelCss(String prefix, Level level) {
		if (null == prefix) {
			prefix = "";
		} else {
			prefix += "-";
		}
		if (level.intLevel() == StandardLevel.TRACE.intLevel()) {
			return prefix + "info";
		}
		if (level.intLevel() == StandardLevel.DEBUG.intLevel()) {
			return prefix + "primary";		
		}
		if (level.intLevel() == StandardLevel.INFO.intLevel()) {
			return prefix + "success";
		}
		if (level.intLevel() == StandardLevel.WARN.intLevel()) {
			return prefix + "warning";
		}
		if (level.intLevel() == StandardLevel.ERROR.intLevel()) {
			return prefix + "danger";
		}
		if (level.intLevel() == StandardLevel.FATAL.intLevel()) {
			return prefix + "muted";
		}
		if (level.intLevel() == StandardLevel.OFF.intLevel()) {
			return prefix + "muted";
		}
		return "";
	}
389681
public static int levelFromString (String level)
    {
        if (level.equalsIgnoreCase("debug")) {
            return DEBUG;
        } else if (level.equalsIgnoreCase("info")) {
            return INFO;
        } else if (level.equalsIgnoreCase("warning")) {
            return WARNING;
        } else {
            return -1;
        }
    }
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;
  }
947884
public void log(Level mesgLevel, String mesg, Throwable t) {
        if (mesgLevel.ordinal() >= level.ordinal()) {
            StringBuilder builder = new StringBuilder();
            builder.append(mesgLevel.name());
            builder.append(": [");
            builder.append(simpleClassName != null ? simpleClassName : className);
            builder.append("] [");
            builder.append(Thread.currentThread());
            builder.append("] ");
            builder.append(mesg);

            if (mesgLevel == Level.SEVERE) {
                if (julLogger != null) {
                    julLogger.log(java.util.logging.Level.SEVERE, builder.toString(), t);
                } else {
                    System.err.println(builder.toString());
                }
            } else {
                if (julLogger != null) {
                    julLogger.info(builder.toString());
                } else {
                    System.out.println(builder.toString());
                }
            }

            if (t != null) {
                t.printStackTrace();
            }
        }
    }
567637
def log_level=(level)
      log_level = java.util.logging.Level.const_get(level.to_s.upcase)

      [ 'com.gargoylesoftware.htmlunit',
        'com.gargoylesoftware.htmlunit.html',
        'com.gargoylesoftware.htmlunit.javascript',
        'org.apache.commons.httpclient'
      ].each { |package| Celerity::Util.logger_for(package).level = log_level }

      level
    end
609637
@VisibleForTesting
  static Level getLogLevel(Throwable t) {
    if (t instanceof IOException
        && t.getMessage() != null
        && QUIET_ERRORS.contains(t.getMessage())) {
      return Level.FINE;
    }
    return Level.INFO;
  }
880808
@Override
    protected void logImpl(LogLevel level,Object[] message,Throwable throwable)
    {
        //format log message (without exception)
        String text=this.formatLogMessage(level,message,null);

        //get log level
        int levelValue=level.getValue();
        switch(levelValue)
        {
            case LogLevel.DEBUG_LOG_LEVEL_VALUE:
                this.APACHE_LOGGER.debug(text);
                break;
            case LogLevel.ERROR_LOG_LEVEL_VALUE:
                this.APACHE_LOGGER.error(text,throwable);
                break;
            case LogLevel.INFO_LOG_LEVEL_VALUE:
            default:
                this.APACHE_LOGGER.info(text);
                break;
        }
    }
832619
static public void setLogLevel(LogLevel level) {
        logLevel = level;
        log.setLevel(level.value());
        for (Handler handler : log.getHandlers()) {
            handler.setLevel(level.value());
        }
    }
1205888
@Nonnull
    public String getLoggerEffectiveLevel(@Nullable String loggerName) {
        try {
            loggerName = loggerName == null ? "" : loggerName;

            if (loggerName.isEmpty()) {
                return LogManager.getRootLogger().getLevel().toString();
            }

            while (true) {
                Logger logger = LogManager.exists(loggerName);
                if (logger == null || logger.getLevel() == null) {
                    int idx = loggerName.lastIndexOf('.');
                    if (idx > 0) {
                        loggerName = loggerName.substring(0, idx - 1);
                    } else {
                        return LogManager.getRootLogger().getLevel().toString();
                    }
                } else {
                    return logger.getLevel().toString();
                }
            }
        } catch (RuntimeException e) {
            logger.warn("Exception getting effective logger level " + loggerName, e);
            throw e;
        }
    }
599957
public void setLoggerLevel(String level) {
        if ("TRACE".equalsIgnoreCase(level)) {
            this.level = TRACE;
        } else if ("DEBUG".equalsIgnoreCase(level)) {
            this.level = DEBUG;
        } else if ("INFO".equalsIgnoreCase(level)) {
            this.level = INFO;
        } else if ("WARN".equalsIgnoreCase(level)) {
            this.level = WARN;
        } else if ("ERROR".equalsIgnoreCase(level)) {
            this.level = ERROR;
        }
    }