[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-28-g8bf8416

Gitbot git-noreply at pixie.qos.ch
Mon Nov 7 20:51:52 CET 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  8bf8416306b4831c65ad74c9d6e947173c253a51 (commit)
      from  7f35c6f1e7ddab9baac0e71de1c9e251844658d8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=8bf8416306b4831c65ad74c9d6e947173c253a51
http://github.com/ceki/logback/commit/8bf8416306b4831c65ad74c9d6e947173c253a51

commit 8bf8416306b4831c65ad74c9d6e947173c253a51
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Mon Nov 7 20:51:13 2011 +0100

    in response to LBCORE-233 added locationAwareLoggerIntegerToLevel method in Level class

diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Level.java b/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
index 88cb247..e46393c 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
@@ -13,6 +13,8 @@
  */
 package ch.qos.logback.classic;
 
+import org.slf4j.spi.LocationAwareLogger;
+
 /**
  * Defines the set of levels recognized by logback-classic, that is {@link #OFF},
  * {@link #ERROR}, {@link #WARN}, {@link #INFO}, {@link #DEBUG},
@@ -91,6 +93,38 @@ public final class Level implements java.io.Serializable {
   }
 
   /**
+   * Convert one of the integer values defined in {@link LocationAwareLogger}
+   * interface to an instance of this class, i.e. a Level.
+   * @param levelInt An integer value representing a level as defined in LocationAwareLogger
+   * @return an instance of this class, i.e. a Level.
+   *
+   * @since 1.0.1
+   */
+  public static Level locationAwareLoggerIntegerToLevel(int levelInt) {
+    Level level;
+    switch (levelInt) {
+    case LocationAwareLogger.TRACE_INT:
+      level = TRACE;
+      break;
+    case LocationAwareLogger.DEBUG_INT:
+      level = DEBUG;
+      break;
+    case LocationAwareLogger.INFO_INT:
+      level = INFO;
+      break;
+    case LocationAwareLogger.WARN_INT:
+      level = WARN;
+      break;
+    case LocationAwareLogger.ERROR_INT:
+      level = ERROR;
+      break;
+    default:
+      throw new IllegalArgumentException(levelInt + " not a valid level value");
+    }
+    return level;
+  }
+
+  /**
    * Returns the string representation of this Level.
    */
   public final String toString() {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
index 0e2c77b..500a9d3 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
@@ -821,25 +821,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
   public void log(Marker marker, String fqcn, int levelInt, String message,
       Object[] argArray, Throwable t) {
     Level level = null;
-    switch (levelInt) {
-    case LocationAwareLogger.TRACE_INT:
-      level = Level.TRACE;
-      break;
-    case LocationAwareLogger.DEBUG_INT:
-      level = Level.DEBUG;
-      break;
-    case LocationAwareLogger.INFO_INT:
-      level = Level.INFO;
-      break;
-    case LocationAwareLogger.WARN_INT:
-      level = Level.WARN;
-      break;
-    case LocationAwareLogger.ERROR_INT:
-      level = Level.ERROR;
-      break;
-    default:
-      throw new IllegalArgumentException(levelInt + " not a valid level value");
-    }
+    level = Level.locationAwareLoggerIntegerToLevel(levelInt);
     filterAndLog_0_Or3Plus(fqcn, marker, level, message, argArray, t);
   }
 

-----------------------------------------------------------------------

Summary of changes:
 .../main/java/ch/qos/logback/classic/Level.java    |   34 ++++++++++++++++++++
 .../main/java/ch/qos/logback/classic/Logger.java   |   20 +-----------
 2 files changed, 35 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list