[slf4j-dev] svn commit: r1149 - slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext

ceki at slf4j.org ceki at slf4j.org
Wed Sep 24 11:41:39 CEST 2008


Author: ceki
Date: Wed Sep 24 11:41:39 2008
New Revision: 1149

Modified:
   slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java

Log:
Xlogger implements the org.slf4j.Logger interface. This avoids users from having to
instantiate both an xlogger and a logger. An Xlogger can now serve as a Logger.
This enhancement was requested by Ralph Goers in a private email.

Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java
==============================================================================
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java	(original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/ext/XLogger.java	Wed Sep 24 11:41:39 2008
@@ -14,7 +14,7 @@
  * @author Ralph Goers
  * @author Ceki Gulcu
  */
-public class XLogger {
+public class XLogger implements Logger {
 
   private static final String FQCN = XLogger.class.getName();
   static Marker FLOW_MARKER = MarkerFactory.getMarker("FLOW");
@@ -50,6 +50,11 @@
 
   final Logger logger;
 
+  /**
+   * Given an underlying logger, constuct an XLogger
+   * 
+   * @param logger underlying logger
+   */
   public XLogger(Logger logger) {
 
     if (logger instanceof LocationAwareLogger) {
@@ -140,4 +145,439 @@
     return sb.toString();
   }
 
+  // =====================================
+  // org.slf4j.Logger methods
+  // =====================================
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isTraceEnabled() {
+    return logger.isTraceEnabled();
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isTraceEnabled(Marker marker) {
+    return logger.isTraceEnabled(marker);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(String msg) {
+    logger.trace(msg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(String format, Object arg) {
+    logger.trace(format, arg);
+  }
+  
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(String format, Object arg1, Object arg2) {
+    logger.trace(format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(String format, Object[] argArray) {
+    logger.trace(format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(String msg, Throwable t) {
+    logger.trace(msg, t);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(Marker marker, String msg) {
+    logger.trace(marker, msg);
+  }
+  
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(Marker marker, String format, Object arg) {
+    logger.trace(marker, format, arg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(Marker marker, String format, Object arg1, Object arg2) {
+    logger.trace(marker, format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(Marker marker, String format, Object[] argArray) {
+    logger.trace(marker, format, argArray);
+  }
+  
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void trace(Marker marker, String msg, Throwable t) {
+    logger.trace(marker, msg, t);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isDebugEnabled() {
+    return logger.isDebugEnabled();
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isDebugEnabled(Marker marker) {
+    return logger.isDebugEnabled(marker);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(String msg) {
+    logger.debug(msg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(String format, Object arg) {
+    logger.debug(format, arg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(String format, Object arg1, Object arg2) {
+    logger.debug(format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(String format, Object[] argArray) {
+    logger.debug(format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(String msg, Throwable t) {
+    logger.debug(msg, t);
+  }
+  
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(Marker marker, String msg) {
+    logger.debug(marker, msg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(Marker marker, String format, Object arg) {
+    logger.debug(marker, format, arg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(Marker marker, String format, Object arg1, Object arg2) {
+    logger.debug(marker, format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(Marker marker, String format, Object[] argArray) {
+    logger.debug(marker, format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void debug(Marker marker, String msg, Throwable t) {
+    logger.debug(marker, msg, t);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isInfoEnabled() {
+    return logger.isInfoEnabled();
+  }
+  
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isInfoEnabled(Marker marker) {
+    return logger.isInfoEnabled(marker);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(String msg) {
+    logger.info(msg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(String format, Object arg) {
+    logger.info(format, arg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(String format, Object arg1, Object arg2) {
+    logger.info(format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(String format, Object[] argArray) {
+    logger.info(format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(String msg, Throwable t) {
+    logger.info(msg, t);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(Marker marker, String msg) {
+    logger.info(marker, msg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(Marker marker, String format, Object arg) {
+    logger.info(marker, format, arg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(Marker marker, String format, Object arg1, Object arg2) {
+    logger.info(marker, format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(Marker marker, String format, Object[] argArray) {
+    logger.info(marker, format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void info(Marker marker, String msg, Throwable t) {
+    logger.info(marker, msg, t);
+  }
+
+  public boolean isWarnEnabled() {
+    return logger.isWarnEnabled();
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isWarnEnabled(Marker marker) {
+    return logger.isWarnEnabled(marker);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(String msg) {
+    logger.warn(msg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(String format, Object arg) {
+    logger.warn(format, arg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(String format, Object arg1, Object arg2) {
+    logger.warn(format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(String format, Object[] argArray) {
+    logger.warn(format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(String msg, Throwable t) {
+    logger.warn(msg, t);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(Marker marker, String msg) {
+    logger.warn(marker, msg);
+  }
+  
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(Marker marker, String format, Object arg) {
+    logger.warn(marker, format, arg);
+  }
+  
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(Marker marker, String format, Object arg1, Object arg2) {
+    logger.warn(marker, format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(Marker marker, String format, Object[] argArray) {
+    logger.warn(marker, format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void warn(Marker marker, String msg, Throwable t) {
+    logger.warn(marker, msg, t);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isErrorEnabled() {
+    return logger.isErrorEnabled();
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public boolean isErrorEnabled(Marker marker) {
+    return logger.isErrorEnabled(marker);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(String msg) {
+    logger.error(msg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(String format, Object arg) {
+    logger.error(format, arg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void errot(String format, Object arg1, Object arg2) {
+    logger.error(format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(String format, Object[] argArray) {
+    logger.error(format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(String msg, Throwable t) {
+    logger.error(msg, t);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(Marker marker, String msg) {
+    logger.error(marker, msg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(Marker marker, String format, Object arg) {
+    logger.error(marker, format, arg);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(String format, Object arg1, Object arg2) {
+    logger.error(format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(Marker marker, String format, Object arg1, Object arg2) {
+    logger.error(marker, format, arg1, arg2);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(Marker marker, String format, Object[] argArray) {
+    logger.error(marker, format, argArray);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public void error(Marker marker, String msg, Throwable t) {
+    logger.error(marker, msg, t);
+  }
+
+  /**
+   * Delegate to the appropriate method of the underlying logger.
+   */
+  public String getName() {
+    return logger.getName();
+  }
+
 }



More information about the slf4j-dev mailing list