logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1580699 - /logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
Date Mon, 24 Mar 2014 02:08:00 GMT
Author: ggregory
Date: Mon Mar 24 02:07:59 2014
New Revision: 1580699

URL: http://svn.apache.org/r1580699
Log:
Sort methods.

Modified:
    logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java

Modified: logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java?rev=1580699&r1=1580698&r2=1580699&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/SLF4JLogger.java
Mon Mar 24 02:07:59 2014
@@ -34,63 +34,18 @@ public class SLF4JLogger extends Abstrac
     private final org.slf4j.Logger logger;
     private final LocationAwareLogger locationAwareLogger;
 
-    public SLF4JLogger(final String name, final org.slf4j.Logger logger) {
-        super(name);
+    public SLF4JLogger(final String name, final MessageFactory messageFactory, final org.slf4j.Logger
logger) {
+        super(name, messageFactory);
         this.logger = logger;
         this.locationAwareLogger = logger instanceof LocationAwareLogger ? (LocationAwareLogger)
logger : null;
     }
 
-    public SLF4JLogger(final String name, final MessageFactory messageFactory, final org.slf4j.Logger
logger) {
-        super(name, messageFactory);
+    public SLF4JLogger(final String name, final org.slf4j.Logger logger) {
+        super(name);
         this.logger = logger;
         this.locationAwareLogger = logger instanceof LocationAwareLogger ? (LocationAwareLogger)
logger : null;
     }
     
-    @Override
-    public void logMessage(String fqcn, Level level, Marker marker, Message message, Throwable
t) {
-        if (locationAwareLogger != null) {
-            if (message instanceof LoggerNameAwareMessage) {
-                ((LoggerNameAwareMessage) message).setLoggerName(getName());
-            }
-            locationAwareLogger.log(getMarker(marker), fqcn, convertLevel(level), message.getFormattedMessage(),
-                    message.getParameters(), t);
-        } else {
-            switch (level.getStandardLevel()) {
-                case DEBUG :
-                    logger.debug(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
-                    break;
-                case TRACE :
-                    logger.trace(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
-                    break;
-                case INFO :
-                    logger.info(fqcn, getMarker(marker), message.getFormattedMessage(), message.getParameters(),
t);
-                    break;
-                case WARN :
-                    logger.warn(fqcn, getMarker(marker), message.getFormattedMessage(), message.getParameters(),
t);
-                    break;
-                case ERROR :
-                    logger.error(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
-                    break;
-                default :
-                    logger.error(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
-                    break;
-            }
-        }
-    }
-
-    private org.slf4j.Marker getMarker(final Marker marker) {
-        if (marker == null) {
-            return null;
-        }
-        final Marker parent = marker.getParent();
-        final org.slf4j.Marker parentMarker = parent == null ? null : getMarker(parent);
-        final org.slf4j.Marker slf4jMarker = MarkerFactory.getMarker(marker.getName());
-        if (parentMarker != null && !slf4jMarker.contains(parentMarker)) {
-            slf4jMarker.add(parentMarker);
-        }
-        return slf4jMarker;
-    }
-
     private int convertLevel(final Level level) {
         switch (level.getStandardLevel()) {
             case DEBUG :
@@ -108,28 +63,45 @@ public class SLF4JLogger extends Abstrac
         }
     }
 
+    public org.slf4j.Logger getLogger() {
+        return locationAwareLogger != null ? locationAwareLogger : logger;
+    }
+
+    private org.slf4j.Marker getMarker(final Marker marker) {
+        if (marker == null) {
+            return null;
+        }
+        final Marker parent = marker.getParent();
+        final org.slf4j.Marker parentMarker = parent == null ? null : getMarker(parent);
+        final org.slf4j.Marker slf4jMarker = MarkerFactory.getMarker(marker.getName());
+        if (parentMarker != null && !slf4jMarker.contains(parentMarker)) {
+            slf4jMarker.add(parentMarker);
+        }
+        return slf4jMarker;
+    }
+
     @Override
-    public boolean isEnabled(final Level level, final Marker marker, final String data) {
+    public boolean isEnabled(final Level level, final Marker marker, final Message data,
final Throwable t) {
         return isEnabledFor(level, marker);
     }
 
     @Override
-    public boolean isEnabled(final Level level, final Marker marker, final String data, final
Throwable t) {
+    public boolean isEnabled(final Level level, final Marker marker, final Object data, final
Throwable t) {
         return isEnabledFor(level, marker);
     }
 
     @Override
-    public boolean isEnabled(final Level level, final Marker marker, final String data, final
Object... p1) {
+    public boolean isEnabled(final Level level, final Marker marker, final String data) {
         return isEnabledFor(level, marker);
     }
 
     @Override
-    public boolean isEnabled(final Level level, final Marker marker, final Object data, final
Throwable t) {
+    public boolean isEnabled(final Level level, final Marker marker, final String data, final
Object... p1) {
         return isEnabledFor(level, marker);
     }
 
     @Override
-    public boolean isEnabled(final Level level, final Marker marker, final Message data,
final Throwable t) {
+    public boolean isEnabled(final Level level, final Marker marker, final String data, final
Throwable t) {
         return isEnabledFor(level, marker);
     }
 
@@ -152,8 +124,36 @@ public class SLF4JLogger extends Abstrac
         }
     }
 
-    public org.slf4j.Logger getLogger() {
-        return locationAwareLogger != null ? locationAwareLogger : logger;
+    @Override
+    public void logMessage(String fqcn, Level level, Marker marker, Message message, Throwable
t) {
+        if (locationAwareLogger != null) {
+            if (message instanceof LoggerNameAwareMessage) {
+                ((LoggerNameAwareMessage) message).setLoggerName(getName());
+            }
+            locationAwareLogger.log(getMarker(marker), fqcn, convertLevel(level), message.getFormattedMessage(),
+                    message.getParameters(), t);
+        } else {
+            switch (level.getStandardLevel()) {
+                case DEBUG :
+                    logger.debug(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
+                    break;
+                case TRACE :
+                    logger.trace(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
+                    break;
+                case INFO :
+                    logger.info(fqcn, getMarker(marker), message.getFormattedMessage(), message.getParameters(),
t);
+                    break;
+                case WARN :
+                    logger.warn(fqcn, getMarker(marker), message.getFormattedMessage(), message.getParameters(),
t);
+                    break;
+                case ERROR :
+                    logger.error(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
+                    break;
+                default :
+                    logger.error(fqcn, getMarker(marker), message.getFormattedMessage(),
message.getParameters(), t);
+                    break;
+            }
+        }
     }
 
 }



Mime
View raw message