Formats a log level into one of the accepted string representation of a log level.

@param level log level to format.
@return log level as a String.
166245
private String formatLevel(Event.Level level) {
        if (level == null) {
            return null;
        }

        switch (level) {
            case DEBUG:
                return "debug";
            case FATAL:
                return "fatal";
            case WARNING:
                return "warning";
            case INFO:
                return "info";
            case ERROR:
                return "error";
            default:
                logger.error("The level '{}' isn't supported, this should NEVER happen, contact Sentry developers",
                    level.name());
                return null;
        }
    }
1294803
def to_string(level):
        
        if level == LogLevel.Fatal:
            return "FATAL" 
        if level == LogLevel.Error:
            return "ERROR" 
        if level == LogLevel.Warn:
            return "WARN" 
        if level == LogLevel.Info:
            return "INFO" 
        if level == LogLevel.Debug:
            return "DEBUG" 
        if level == LogLevel.Trace:
            return "TRACE"
        return "UNDEF"
1265142
@SuppressWarnings({ "checkstyle:returncount", "checkstyle:cyclomaticcomplexity" })
	public static Level parseLoggingLevel(String level) {
		if (level == null) {
			return Level.INFO;
		}
		switch (level.toLowerCase()) {
		case "none": //$NON-NLS-1$
		case "false": //$NON-NLS-1$
		case "0": //$NON-NLS-1$
			return Level.OFF;
		case "severe": //$NON-NLS-1$
		case "error": //$NON-NLS-1$
		case "1": //$NON-NLS-1$
			return Level.SEVERE;
		case "warn": //$NON-NLS-1$
		case "warning": //$NON-NLS-1$
		case "2": //$NON-NLS-1$
			return Level.WARNING;
		case "info": //$NON-NLS-1$
		case "true": //$NON-NLS-1$
		case "3": //$NON-NLS-1$
			return Level.INFO;
		case "fine": //$NON-NLS-1$
		case "config": //$NON-NLS-1$
		case "4": //$NON-NLS-1$
			return Level.FINE;
		case "finer": //$NON-NLS-1$
		case "5": //$NON-NLS-1$
			return Level.FINER;
		case "finest": //$NON-NLS-1$
		case "debug": //$NON-NLS-1$
		case "6": //$NON-NLS-1$
			return Level.FINEST;
		case "all": //$NON-NLS-1$
		case "7": //$NON-NLS-1$
			return Level.ALL;
		default:
			try {
				return fromInt(Integer.parseInt(level));
			} catch (Throwable exception) {
				//
			}
			return Level.INFO;
		}
	}
1177373
private void formatAndLog(int level, String format, Object arg1, Object arg2) {
        if (!isLevelEnabled(level)) {
            return;
        }
        FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
        log(level, tp.getMessage(), tp.getThrowable());
    }
1102695
public function levelToString($level)
    {
        $mapping = [
            self::LOG_LEVEL_DEBUG => 'debug',
            self::LOG_LEVEL_INFO => 'info',
            self::LOG_LEVEL_WARN => 'warn',
            self::LOG_LEVEL_ERROR => 'error',
            self::LOG_LEVEL_FATAL => 'fatal',
        ];
        return isset($mapping[$level]) ? $mapping[$level] : 'unknown';
    }
90841
def set_log_level_format(level, format):
    
    formatter = logging.Formatter(fmt=format)
    logger.handlers[0].setFormatter(formatter)
    logger.setLevel(level)
1228781
final public static function logLevelToPsr($level)
    {
        $origLevel = $level;

        if (is_numeric($level)) {
            $level = intval($level);
            if (isset(self::$psrLevels[$level])) {
                return self::$psrLevels[$level];
            }
        } elseif (is_string($level)) {
            $level = strtolower($level);
            if (in_array($level, self::$psrLevels)) {
                return $level;
            }
        }

        throw new RuntimeException(
            sprintf("Cannot convert log-level '%s' to psr-style", $origLevel)
        );
    }
686296
public void setLevel(@NonNull LogLevel level) {
        if (level == null) { throw new IllegalArgumentException("level cannot be null."); }

        if (logLevel == level) { return; }

        logLevel = level;
        setCallbackLevel(level);
    }
848773
@Override
	public String format(LogRecord record) {
		/*String loggerName = record.getLoggerName();
		if (loggerName == null) {
			loggerName = "root";
		}*/
		// .append(loggerName)
		return "[" +
				StringUtils.repeat(" ", 8 - record.getLevel().toString().length()) +
				record.getLevel() + '|' +
				StringUtils.repeat(" ", 12 - Thread.currentThread().getName().length()) +
				Thread.currentThread().getName() + '|' +
				format.format(new Date(record.getMillis())) +
				"]: " +
				record.getMessage() + ' ' +
				lineSep;
	}
144143
public String format(final LoggingEvent event) {
		final StringBuffer buf = new StringBuffer();
		for (PatternConverter c = head; c != null; c = c.next) {
			c.format(buf, event);
		}
		return buf.toString();
	}
787476
public static String formatBetween(long betweenMs, BetweenFormater.Level level) {
		return new BetweenFormater(betweenMs, level).format();
	}
358309
@Override
	public void log(com.silentgo.utils.log.level.Level level, String format, Object... arguments) {
		log(level, null, format, arguments);
	}
128259
private function get_log_level( $level, $log_level ) {
		if ( ! isset( $log_level[ $level ] ) && ! isset( $log_level[''] ) ) {
			return 'info';
		}
		'' === $level || ! isset( $log_level[ $level ] ) and $level = $log_level[''];
		if ( empty( $log_level[ $level ] ) ) {
			return 'info';
		}

		return $level;
	}
254310
public List<LogEvent> getLogsFrom(LogLevel level)
    {
        List<LogEvent> levelLogs = new LinkedList<LogEvent>();

        for (LogEvent log : this) {
            if (log.getLevel().compareTo(level) <= 0) {
                levelLogs.add(log);
            }
        }

        return levelLogs;
    }
1352861
public static LoggingFraction createDefaultLoggingFraction(Level level) {
        return new LoggingFraction()
                .defaultColorFormatter()
                .consoleHandler(level, COLOR_PATTERN)
                .rootLogger(level, CONSOLE);
    }
1374632
public void logv(Level level, Throwable t, String format, Object... params) {
        doLog(level, FQCN, format, params, t);
    }
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;
  }