diff --git a/slf4j-simple/src/main/java/org/slf4j/simple/SimpleLogger.java b/slf4j-simple/src/main/java/org/slf4j/simple/SimpleLogger.java index 93638ee82..9b8b99ff0 100644 --- a/slf4j-simple/src/main/java/org/slf4j/simple/SimpleLogger.java +++ b/slf4j-simple/src/main/java/org/slf4j/simple/SimpleLogger.java @@ -409,7 +409,7 @@ private void innerHandleNormalizedLoggingCall(Level level, List markers, buf.append('['); // Append a readable representation of the log level - String levelStr = level.name(); + String levelStr = renderLevel(level.toInt()); buf.append(levelStr); if (CONFIG_PARAMS.levelInBrackets) buf.append(']'); @@ -439,6 +439,22 @@ private void innerHandleNormalizedLoggingCall(Level level, List markers, write(buf, t); } + protected String renderLevel(int level) { + switch (level) { + case LOG_LEVEL_TRACE: + return "TRACE"; + case LOG_LEVEL_DEBUG: + return("DEBUG"); + case LOG_LEVEL_INFO: + return "INFO"; + case LOG_LEVEL_WARN: + return "WARN"; + case LOG_LEVEL_ERROR: + return "ERROR"; + } + throw new IllegalStateException("Unrecognized level ["+level+"]"); + } + public void log(LoggingEvent event) { int levelInt = event.getLevel().toInt();