[slf4j-dev] svn commit: r134 - in slf4j/trunk/src/java/org/slf4j: . impl

ceki at slf4j.org ceki at slf4j.org
Mon Jul 18 16:31:00 CEST 2005


Author: ceki
Date: Mon Jul 18 16:30:58 2005
New Revision: 134

Modified:
   slf4j/trunk/src/java/org/slf4j/ILoggerFactory.java
   slf4j/trunk/src/java/org/slf4j/Logger.java
   slf4j/trunk/src/java/org/slf4j/impl/JDK14LoggerAdapter.java
   slf4j/trunk/src/java/org/slf4j/impl/NOPLogger.java
   slf4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java
Log:

Added new methods in Logger in relation with Markers.



Modified: slf4j/trunk/src/java/org/slf4j/ILoggerFactory.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/ILoggerFactory.java	(original)
+++ slf4j/trunk/src/java/org/slf4j/ILoggerFactory.java	Mon Jul 18 16:30:58 2005
@@ -40,8 +40,8 @@
  * ILoggerFactory interface is used internally by {@link
  * LoggerFactory}.
  * 
- * <p>Only developers wishing to write new SLF4J adapters need to
- * worry about this interface.
+ * <p>Normally, only developers wishing to write new SLF4J adapters need to
+ * worry about this interface. However, 
  * 
  * @author Ceki G&uuml;lc&uuml;
  *

Modified: slf4j/trunk/src/java/org/slf4j/Logger.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/Logger.java	(original)
+++ slf4j/trunk/src/java/org/slf4j/Logger.java	Mon Jul 18 16:30:58 2005
@@ -48,7 +48,8 @@
    * false otherwise.
    */
   public boolean isDebugEnabled();
-  
+
+  public boolean isDebugEnabled(Marker marker);
   /**
    * Log a message at the DEBUG level.
    *
@@ -77,6 +78,8 @@
    */
   public void debug(String format, Object arg);
 
+  public void debug(Marker marker, String format, Object arg);
+  
   /**
    * Log a message at the DEBUG level according to the specified format
    * and arguments.
@@ -90,6 +93,8 @@
    */
   public void debug(String format, Object arg1, Object arg2);
 
+  public void debug(Marker marker, String format, Object arg1, Object arg2);
+ 
 
   /**
    * Log an exception (throwable) at the DEBUG level with an
@@ -100,7 +105,8 @@
    */ 
   public void debug(String msg, Throwable t);
   
-
+  public void debug(Marker marker, String msg, Throwable t);
+  
   /**
    * Is the logger instance enabled for the INFO level?
    * @return True if this Logger is enabled for the INFO level,
@@ -108,12 +114,17 @@
    */
   public boolean isInfoEnabled();
 
+  public boolean isInfoEnabled(Marker marker);
+  
   /**
    * Log a message at the INFO level.
    *
    * @param msg the message string to be logged
    */
   public void info(String msg);
+  
+  public void info(Marker marker, String msg);
+  
 
   /**
    * Log a message at the INFO level according to the specified format
@@ -149,6 +160,11 @@
    */
   public void info(String msg, Throwable t);
 
+  public void info(Marker marker, String format, Object arg);
+  public void info(Marker marker, String format, Object arg1, Object arg2);  
+  public void info(Marker marker, String msg, Throwable t); 
+
+  
   /**
    * Is the logger instance enabled for the WARN level?
    * @return True if this Logger is enabled for the WARN level,
@@ -197,6 +213,12 @@
    */
   public void warn(String msg, Throwable t);
 
+  public void warn(Marker marker, String msg); 
+  public void warn(Marker marker, String format, Object arg);
+  public void warn(Marker marker, String format, Object arg1, Object arg2);  
+  public void warn(Marker marker, String msg, Throwable t); 
+  public boolean isWarnEnabled(Marker marker);
+
   /**
    * Is the logger instance enabled for the ERROR level?
    * @return True if this Logger is enabled for the ERROR level,
@@ -245,4 +267,10 @@
    */
   public void error(String msg, Throwable t);
 
+  public void error(Marker marker, String msg); 
+  public void error(Marker marker, String format, Object arg);
+  public void error(Marker marker, String format, Object arg1, Object arg2);  
+  public void error(Marker marker, String msg, Throwable t); 
+  public boolean isErrorEnabled(Marker marker);
+
 }

Modified: slf4j/trunk/src/java/org/slf4j/impl/JDK14LoggerAdapter.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/impl/JDK14LoggerAdapter.java	(original)
+++ slf4j/trunk/src/java/org/slf4j/impl/JDK14LoggerAdapter.java	Mon Jul 18 16:30:58 2005
@@ -1,9 +1,9 @@
-/* 
+/*
  * Copyright (c) 2004-2005 SLF4J.ORG
  * Copyright (c) 2004-2005 QOS.ch
- * 
+ *
  * All rights reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
  * "Software"), to  deal in  the Software without  restriction, including
@@ -13,7 +13,7 @@
  * copyright notice(s) and this permission notice appear in all copies of
  * the  Software and  that both  the above  copyright notice(s)  and this
  * permission notice appear in supporting documentation.
- * 
+ *
  * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
  * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
@@ -23,7 +23,7 @@
  * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
  * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- * 
+ *
  * Except as  contained in  this notice, the  name of a  copyright holder
  * shall not be used in advertising or otherwise to promote the sale, use
  * or other dealings in this Software without prior written authorization
@@ -32,7 +32,9 @@
  */
 
 package org.slf4j.impl;
+
 import org.slf4j.Logger;
+import org.slf4j.Marker;
 
 import java.util.logging.Level;
 
@@ -42,10 +44,10 @@
  * java.util.logging.Logger} in conformance with the {@link Logger}
  * interface. Note that the logging levels mentioned in this class
  * refer to those defined in the java.util.logging package.
- 
+
  * @author Ceki G&uuml;lc&uuml;
  */
-public class JDK14LoggerAdapter implements Logger {
+public final class JDK14LoggerAdapter implements Logger {
   final java.util.logging.Logger logger;
 
   // WARN: JDK14LoggerAdapter constructor should have only package access so that
@@ -64,6 +66,10 @@
     return logger.isLoggable(Level.FINE);
   }
 
+  public boolean isDebugEnabled(Marker marker) {
+    return isDebugEnabled();
+  }
+
   //
 
   /**
@@ -74,15 +80,18 @@
     logger.fine(msg);
   }
 
- 
+  public void debug(Marker marker, String msg) {
+    debug(msg);
+  }
+
   /**
    * Log a message at level FINE according to the specified format and
    * argument.
-   * 
+   *
    * <p>This form avoids superfluous object creation when the logger
    * is disabled for level FINE. </p>
    *
-   * @param format the format string 
+   * @param format the format string
    * @param arg  the argument
    */
   public void debug(String format, Object arg) {
@@ -92,29 +101,36 @@
     }
   }
 
+  public void debug(Marker marker, String format, Object arg) {
+    debug(format, arg);
+  }
 
   /**
    * Log a message at level FINE according to the specified format and
    * arguments.
-   * 
+   *
    * <p>This form avoids superfluous object creation when the logger
    * is disabled for the FINE level. </p>
    *
    * @param format the format string
    * @param arg1  the first argument
    * @param arg2  the second argument
-   */  
+   */
   public void debug(String format, Object arg1, Object arg2) {
-    if (logger.isLoggable(Level.FINE)) {     
+    if (logger.isLoggable(Level.FINE)) {
       String msgStr = MessageFormatter.format(format, arg1, arg2);
       logger.fine(msgStr);
     }
   }
 
+  public void debug(Marker marker, String format, Object arg1, Object arg2) {
+    debug(format, arg1, arg2);
+  }
+
   /**
    * Log an exception (throwable) at  level FINE with an
-   * accompanying message. 
-   * 
+   * accompanying message.
+   *
    * @param msg the message accompanying the exception
    * @param t the exception (throwable) to log
    */
@@ -122,6 +138,10 @@
     logger.log(Level.FINE, msg, t);
   }
 
+  public void debug(Marker marker, String msg, Throwable t) {
+    debug(msg, t);
+  }
+
   /**
    * Is this logger instance enabled for the INFO level?
    *
@@ -132,6 +152,10 @@
     return logger.isLoggable(Level.INFO);
   }
 
+  public final boolean isInfoEnabled(Marker marker) {
+    return isInfoEnabled();
+  }
+
   /**
    * Log a message object at the INFO level.
    *
@@ -141,14 +165,18 @@
     logger.info(msg);
   }
 
+  public void info(Marker marker, String msg) {
+    logger.info(msg);
+  }
+
   /**
    * Log a message at level INFO according to the specified format and
    * argument.
-   * 
+   *
    * <p>This form avoids superfluous object creation when the logger
    * is disabled for the INFO level. </p>
    *
-   * @param format the format string 
+   * @param format the format string
    * @param arg  the argument
    */
   public void info(String format, Object arg) {
@@ -158,11 +186,10 @@
     }
   }
 
-
   /**
    * Log a message at the INFO level according to the specified format
    * and arguments.
-   * 
+   *
    * <p>This form avoids superfluous object creation when the logger
    * is disabled for the INFO level. </p>
    *
@@ -179,8 +206,8 @@
 
   /**
    * Log an exception (throwable) at the INFO level with an
-   * accompanying message. 
-   * 
+   * accompanying message.
+   *
    * @param msg the message accompanying the exception
    * @param t the exception (throwable) to log
    */
@@ -188,6 +215,18 @@
     logger.log(Level.INFO, msg, t);
   }
 
+  public void info(Marker marker, String format, Object arg) {
+      info(format, arg);
+    }
+
+    public void info(Marker marker, String format, Object arg1, Object arg2) {
+      info(format, arg1, arg2);
+    }
+
+    public void info(Marker marker, String msg, Throwable t) {
+       info(msg, t);
+    }
+    
   /**
    * Is this logger instance enabled for the WARNING level?
    *
@@ -197,6 +236,10 @@
   public boolean isWarnEnabled() {
     return logger.isLoggable(Level.WARNING);
   }
+  
+  public boolean isWarnEnabled(Marker marker) {
+      return isWarnEnabled();
+  }
 
   /**
    * Log a message object at the WARNING level.
@@ -210,11 +253,11 @@
   /**
    * Log a message at the WARNING level according to the specified
    * format and argument.
-   * 
+   *
    * <p>This form avoids superfluous object creation when the logger
    * is disabled for the WARNING level. </p>
    *
-   * @param format the format string 
+   * @param format the format string
    * @param arg  the argument
    */
   public void warn(String format, Object arg) {
@@ -224,11 +267,10 @@
     }
   }
 
-
   /**
    * Log a message at the WARNING level according to the specified
    * format and arguments.
-   * 
+   *
    * <p>This form avoids superfluous object creation when the logger
    * is disabled for the WARNING level. </p>
    *
@@ -246,7 +288,7 @@
   /**
    * Log an exception (throwable) at the WARNING level with an
    * accompanying message.
-   * 
+   *
    * @param msg the message accompanying the exception
    * @param t the exception (throwable) to log
    */
@@ -254,9 +296,25 @@
     logger.log(Level.WARNING, msg.toString(), t);
   }
 
+  public void warn(Marker marker, String msg) {
+    warn(msg);
+  }
+
+  public void warn(Marker marker, String format, Object arg) {
+    warn(format, arg);
+  }
+
+  public void warn(Marker marker, String format, Object arg1, Object arg2) {
+    warn(format, arg1, arg2);
+  }
+
+  public void warn(Marker marker, String msg, Throwable t) {
+    warn(msg, t);
+  }
+
   /**
    * Is this logger instance enabled for level SEVERE?
-   * 
+   *
    * @return True if this Logger is enabled for level SEVERE, false
    * otherwise.
    */
@@ -264,6 +322,10 @@
     return logger.isLoggable(Level.SEVERE);
   }
 
+  public boolean isErrorEnabled(Marker marker) {
+      return isErrorEnabled();
+    }
+  
   /**
    * Log a message object at the SEVERE level.
    *
@@ -276,25 +338,24 @@
   /**
    * Log a message at the SEVERE level according to the specified
    * format and argument.
-   * 
+   *
    * <p>This form avoids superfluous object creation when the logger
    * is disabled for the SEVERE level. </p>
    *
-   * @param format the format string 
+   * @param format the format string
    * @param arg  the argument
    */
   public void error(String format, Object arg) {
     if (logger.isLoggable(Level.SEVERE)) {
       String msgStr = MessageFormatter.format(format, arg);
-      logger.severe(msgStr);    
+      logger.severe(msgStr);
     }
   }
-  
 
   /**
    * Log a message at the SEVERE level according to the specified
    * format and arguments.
-   * 
+   *
    * <p>This form avoids superfluous object creation when the logger
    * is disabled for the SEVERE level. </p>
    *
@@ -311,12 +372,28 @@
 
   /**
    * Log an exception (throwable) at the SEVERE level with an
-   * accompanying message. 
-   * 
+   * accompanying message.
+   *
    * @param msg the message accompanying the exception
    * @param t the exception (throwable) to log
    */
   public void error(String msg, Throwable t) {
     logger.log(Level.SEVERE, msg, t);
   }
+
+  public void error(Marker marker, String msg) {
+    error(msg);
+  }
+
+  public void error(Marker marker, String format, Object arg) {
+    error(format, arg);
+  }
+
+  public void error(Marker marker, String format, Object arg1, Object arg2) {
+    error(format, arg1, arg2);
+  }
+
+  public void error(Marker marker, String msg, Throwable t) {
+    error(msg, t);
+  }
 }

Modified: slf4j/trunk/src/java/org/slf4j/impl/NOPLogger.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/impl/NOPLogger.java	(original)
+++ slf4j/trunk/src/java/org/slf4j/impl/NOPLogger.java	Mon Jul 18 16:30:58 2005
@@ -1,9 +1,9 @@
-/* 
+/*
  * Copyright (c) 2004-2005 SLF4J.ORG
  * Copyright (c) 2004-2005 QOS.ch
  *
  * All rights reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
  * "Software"), to  deal in  the Software without  restriction, including
@@ -13,7 +13,7 @@
  * copyright notice(s) and this permission notice appear in all copies of
  * the  Software and  that both  the above  copyright notice(s)  and this
  * permission notice appear in supporting documentation.
- * 
+ *
  * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
  * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
@@ -23,7 +23,7 @@
  * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
  * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- * 
+ *
  * Except as  contained in  this notice, the  name of a  copyright holder
  * shall not be used in advertising or otherwise to promote the sale, use
  * or other dealings in this Software without prior written authorization
@@ -34,27 +34,27 @@
 package org.slf4j.impl;
 
 import org.slf4j.Logger;
+import org.slf4j.Marker;
 
 
 /**
  * A direct NOP (no operation) implementation of {@link Logger}.
- * 
+ *
  * @author Ceki G&uuml;lc&uuml;
  */
-public class NOPLogger implements Logger {
-
+public final class NOPLogger implements Logger {
   /**
    * The unique instance of NOPLogger.
    */
-  public final static NOPLogger NOP_LOGGER = new NOPLogger();
-  
+  public static final NOPLogger NOP_LOGGER = new NOPLogger();
+
   /**
    * There is no point in creating multiple instances of NullLogger,
    * hence the private access modifier.
    */
   private NOPLogger() {
   }
-  
+
   /**
    * Always returns false.
    * @return always false
@@ -74,7 +74,7 @@
   }
 
   /** A NOP implementation.  */
-  public void debug(String format, Object arg1, Object arg2) {
+  public final void debug(String format, Object arg1, Object arg2) {
     // NOP
   }
 
@@ -93,16 +93,40 @@
   }
 
   /** A NOP implementation. */
+  public void debug(Marker marker, String msg) {
+  }
+
+  /** A NOP implementation. */
+  public void debug(Marker marker, String format, Object arg) {
+  }
+
+  /** A NOP implementation. */
+  public void debug(Marker marker, String format, Object arg1, Object arg2) {
+  }
+
+  /** A NOP implementation. */
+  public void debug(Marker marker, String msg, Throwable t) {
+  }
+
+  /**
+   * Always returns false.
+   * @return always false
+   */
+  public boolean isDebugEnabled(Marker marker) {
+    return false;
+  }
+
+  /** A NOP implementation. */
   public void info(String msg) {
     // NOP
   }
 
- /** A NOP implementation. */
+  /** A NOP implementation. */
   public void info(String format, Object arg1) {
     // NOP
   }
 
- /** A NOP implementation. */
+  /** A NOP implementation. */
   public void info(String format, Object arg1, Object arg2) {
     // NOP
   }
@@ -112,6 +136,26 @@
     // NOP
   }
 
+  /** A NOP implementation. */
+  public void info(Marker marker, String msg) {
+  }
+
+  /** A NOP implementation. */
+  public void info(Marker marker, String format, Object arg) {
+  }
+
+  /** A NOP implementation. */
+  public void info(Marker marker, String format, Object arg1, Object arg2) {
+  }
+
+  /** A NOP implementation. */
+  public void info(Marker marker, String msg, Throwable t) {
+  }
+
+  public boolean isInfoEnabled(Marker marker) {
+    return false;
+  }
+
   /**
    * Always returns false.
    * @return always false
@@ -141,16 +185,37 @@
   }
 
   /** A NOP implementation. */
+  public void warn(Marker marker, String msg) {
+  }
+
+  /** A NOP implementation. */
+  public void warn(Marker marker, String format, Object arg) {
+  }
+
+  /** A NOP implementation. */
+  public void warn(Marker marker, String format, Object arg1, Object arg2) {
+  }
+
+  /** A NOP implementation. */
+  public void warn(Marker marker, String msg, Throwable t) {
+  }
+
+  /** Always false. */
+  public boolean isWarnEnabled(Marker marker) {
+    return false;
+  }
+
+  /** A NOP implementation. */
   public boolean isErrorEnabled() {
     return false;
   }
 
-  /** A NOP implementation. */ 
+  /** A NOP implementation. */
   public void error(String msg) {
     // NOP
   }
 
-   /** A NOP implementation. */
+  /** A NOP implementation. */
   public void error(String format, Object arg1) {
     // NOP
   }
@@ -165,4 +230,24 @@
     // NOP
   }
 
+  /** A NOP implementation. */
+  public void error(Marker marker, String msg) {
+  }
+
+  /** A NOP implementation. */
+  public void error(Marker marker, String format, Object arg) {
+  }
+
+  /** A NOP implementation. */
+  public final void error(Marker marker, String format, Object arg1, Object arg2) {
+  }
+
+  /** A NOP implementation. */
+  public void error(Marker marker, String msg, Throwable t) {
+  }
+
+  /** A NOP implementation. */
+  public final boolean isErrorEnabled(Marker marker) {
+    return false;
+  }
 }

Modified: slf4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java	(original)
+++ slf4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java	Mon Jul 18 16:30:58 2005
@@ -1,9 +1,9 @@
-/* 
+/*
  * Copyright (c) 2004-2005 SLF4J.ORG
  * Copyright (c) 2004-2005 QOS.ch
  *
  * All rights reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
  * "Software"), to  deal in  the Software without  restriction, including
@@ -13,7 +13,7 @@
  * copyright notice(s) and this permission notice appear in all copies of
  * the  Software and  that both  the above  copyright notice(s)  and this
  * permission notice appear in supporting documentation.
- * 
+ *
  * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
  * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
@@ -23,7 +23,7 @@
  * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
  * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- * 
+ *
  * Except as  contained in  this notice, the  name of a  copyright holder
  * shall not be used in advertising or otherwise to promote the sale, use
  * or other dealings in this Software without prior written authorization
@@ -34,6 +34,7 @@
 package org.slf4j.impl;
 
 import org.slf4j.Logger;
+import org.slf4j.Marker;
 
 
 /**
@@ -44,7 +45,7 @@
  * name, the level, logger name, and the message followed by the line
  * separator for the host.  In log4j terms it amounts to the "%r [%t]
  * %level %logger - %m%n" pattern.  *</p>
- * 
+ *
  * <p>Sample output follows.</p>
  * <pre>
 176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
@@ -58,32 +59,29 @@
         at org.log4j.examples.Sort.main(Sort.java:64)
 467 [main] INFO  examples.Sort - Exiting main method.
 </pre>
- * 
+ *
  * @author Ceki G&uuml;lc&uuml;
  */
 public class SimpleLogger implements Logger {
-
-  String loggerName;
-  
   /**
    * Mark the time when this class gets loaded into memory.
    */
-  static private long startTime = System.currentTimeMillis();
-  
-  public static final String LINE_SEPARATOR = System.getProperty("line.separator");
-  
-  static private String INFO_STR = "INFO";
-  static private String WARN_STR = "WARN";
-  static private String ERROR_STR = "ERROR";
-  
+  private static long startTime = System.currentTimeMillis();
+  public static final String LINE_SEPARATOR =
+    System.getProperty("line.separator");
+  private static String INFO_STR = "INFO";
+  private static String WARN_STR = "WARN";
+  private static String ERROR_STR = "ERROR";
+  String loggerName;
+
   /**
-   * Package access allows only {@link SimpleLoggerFactory} to instantiate 
+   * Package access allows only {@link SimpleLoggerFactory} to instantiate
    * SimpleLogger instances.
    */
   SimpleLogger(String name) {
     this.loggerName = name;
   }
-  
+
   /**
    * Always returns false.
    * @return always false
@@ -92,7 +90,15 @@
     return false;
   }
 
-  /** 
+  /**
+   * Always returns false.
+   * @return always false
+   */
+  public boolean isDebugEnabled(Marker marker) {
+    return false;
+  }
+  
+  /**
    * A NOP implementation, as this logger is permanently disabled for
    * the DEBUG level.
    */
@@ -100,7 +106,7 @@
     // NOP
   }
 
-  /** 
+  /**
    * A NOP implementation, as this logger is permanently disabled for
    * the DEBUG level.
    */
@@ -108,7 +114,7 @@
     // NOP
   }
 
-  /** 
+  /**
    * A NOP implementation, as this logger is permanently disabled for
    * the DEBUG level.
    */
@@ -116,7 +122,7 @@
     // NOP
   }
 
-  /** 
+  /**
    * A NOP implementation, as this logger is permanently disabled for
    * the DEBUG level.
    */
@@ -124,36 +130,51 @@
     // NOP
   }
 
+  public void debug(Marker marker, String msg) {
+  }
+
+  public void debug(Marker marker, String format, Object arg) {
+    debug(format, arg);
+  }
+
+  public void debug(Marker marker, String format, Object arg1, Object arg2) {
+    debug(format, arg1, arg2);
+  }
+
+  public void debug(Marker marker, String msg, Throwable t) {
+    debug(msg, t);
+  }
+
   /**
    * This is our internal implementation for logging regular (non-parameterized)
    * log messages.
-   * 
+   *
    * @param level
    * @param message
    * @param t
    */
   private void log(String level, String message, Throwable t) {
     StringBuffer buf = new StringBuffer();
-    
-    long millis  = System.currentTimeMillis();
-    buf.append(millis-startTime);
-    
+
+    long millis = System.currentTimeMillis();
+    buf.append(millis - startTime);
+
     buf.append(" [");
     buf.append(Thread.currentThread().getName());
     buf.append("] ");
-    
+
     buf.append(level);
     buf.append(" ");
-    
+
     buf.append(loggerName);
     buf.append(" - ");
 
     buf.append(message);
 
     buf.append(LINE_SEPARATOR);
-    
+
     System.out.print(buf.toString());
-    if(t != null) {
+    if (t != null) {
       t.printStackTrace(System.out);
     }
     System.out.flush();
@@ -161,17 +182,18 @@
 
   /**
    * For formatted messages, first substitute arguments and then log.
-   * 
+   *
    * @param level
    * @param format
    * @param param1
    * @param param2
    */
-  private void formatAndLog(String level, String format, Object arg1, Object arg2) {
+  private void formatAndLog(
+    String level, String format, Object arg1, Object arg2) {
     String message = MessageFormatter.format(format, arg1, arg2);
     log(level, message, null);
   }
-  
+
   /**
    * Always returns true.
    */
@@ -180,6 +202,13 @@
   }
 
   /**
+   * Always returns true.
+   */
+  public boolean isInfoEnabled(Marker marker) {
+    return true;
+  }
+  
+  /**
    * A simple implementation which always logs messages of level INFO according
    * to the format outlined above.
    */
@@ -187,9 +216,8 @@
     log(INFO_STR, msg, null);
   }
 
-  
   /**
-   * Perform single parameter substituion before logging the message of level 
+   * Perform single parameter substituion before logging the message of level
    * INFO according to the format outlined above.
    */
   public void info(String format, Object arg) {
@@ -197,27 +225,49 @@
   }
 
   /**
-   * Perform double parameter substituion before logging the message of level 
+   * Perform double parameter substituion before logging the message of level
    * INFO according to the format outlined above.
    */
-  
   public void info(String format, Object arg1, Object arg2) {
     formatAndLog(INFO_STR, format, arg1, arg2);
   }
 
-  /** 
+  /**
    * Log a message of level INFO, including an exception.
    */
   public void info(String msg, Throwable t) {
     log(INFO_STR, msg.toString(), t);
   }
 
+  public void info(Marker marker, String msg) {
+    info(msg);
+  }
+
+  public void info(Marker marker, String format, Object arg) {
+    info(format, arg);
+  }
+
+  public void info(Marker marker, String format, Object arg1, Object arg2) {
+    info(format, arg1, arg2);
+  }
+
+  public void info(Marker marker, String msg, Throwable t) {
+    info(msg, t);
+  }
+
   /**
    * Always returns true.
    */
   public boolean isWarnEnabled() {
     return true;
   }
+  
+  /**
+   * Always returns true.
+   */
+  public boolean isWarnEnabled(Marker marker) {
+    return true;
+  }
 
   /**
    * A simple implementation which always logs messages of level WARN according
@@ -228,7 +278,7 @@
   }
 
   /**
-   * Perform single parameter substituion before logging the message of level 
+   * Perform single parameter substituion before logging the message of level
    * WARN according to the format outlined above.
    */
   public void warn(String format, Object arg) {
@@ -236,7 +286,7 @@
   }
 
   /**
-   * Perform double parameter substituion before logging the message of level 
+   * Perform double parameter substituion before logging the message of level
    * WARN according to the format outlined above.
    */
   public void warn(String format, Object arg1, Object arg2) {
@@ -250,6 +300,22 @@
     log(WARN_STR, msg.toString(), t);
   }
 
+  public void warn(Marker marker, String msg) {
+    warn(msg);
+  }
+
+  public void warn(Marker marker, String format, Object arg) {
+    warn(format, arg);
+  }
+
+  public void warn(Marker marker, String format, Object arg1, Object arg2) {
+    warn(format, arg1, arg2);
+  }
+
+  public void warn(Marker marker, String msg, Throwable t) {
+    warn(msg, t);
+  }
+
   /**
    * Always returns true.
    */
@@ -258,6 +324,13 @@
   }
 
   /**
+   * Always returns true.
+   */
+  public boolean isErrorEnabled(Marker marker) {
+    return true;
+  }
+
+  /**
    * A simple implementation which always logs messages of level ERROR acoording
    * to the format outlined above.
    */
@@ -265,9 +338,8 @@
     log(ERROR_STR, msg.toString(), null);
   }
 
-
   /**
-   * Perform single parameter substituion before logging the message of level 
+   * Perform single parameter substituion before logging the message of level
    * ERROR according to the format outlined above.
    */
   public void error(String format, Object arg) {
@@ -275,18 +347,33 @@
   }
 
   /**
-   * Perform double parameter substituion before logging the message of level 
+   * Perform double parameter substituion before logging the message of level
    * ERROR according to the format outlined above.
    */
   public void error(String format, Object arg1, Object arg2) {
     formatAndLog(ERROR_STR, format, arg1, arg2);
   }
 
-  /** 
+  /**
    * Log a message of level ERROR, including an exception.
    */
   public void error(String msg, Throwable t) {
     log(ERROR_STR, msg.toString(), t);
   }
 
+  public void error(Marker marker, String msg) {
+    error(msg);
+  }
+
+  public void error(Marker marker, String format, Object arg) {
+    error(format, arg);
+  }
+
+  public void error(Marker marker, String format, Object arg1, Object arg2) {
+    error(format, arg1, arg2);
+  }
+
+  public void error(Marker marker, String msg, Throwable t) {
+    error(msg, t);
+  }
 }



More information about the slf4j-dev mailing list