[jboss-svn-commits] JBoss Common SVN: r3148 - common-logging-spi/trunk/src/main/java/org/jboss/logging.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon May 11 19:04:12 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-05-11 19:04:12 -0400 (Mon, 11 May 2009)
New Revision: 3148

Modified:
   common-logging-spi/trunk/src/main/java/org/jboss/logging/Logger.java
Log:
JBLOGGING-16 - support formatted log messages

Modified: common-logging-spi/trunk/src/main/java/org/jboss/logging/Logger.java
===================================================================
--- common-logging-spi/trunk/src/main/java/org/jboss/logging/Logger.java	2009-05-11 22:48:23 UTC (rev 3147)
+++ common-logging-spi/trunk/src/main/java/org/jboss/logging/Logger.java	2009-05-11 23:04:12 UTC (rev 3148)
@@ -184,6 +184,29 @@
    }
 
    /**
+    * Issue a formatted log message with a level of TRACE.
+    *
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void tracef(String format, Object... params)
+   {
+      if (isTraceEnabled()) trace(String.format(format, params));
+   }
+
+   /**
+    * Issue a formatted log message with a level of TRACE.
+    *
+    * @param t the throwable
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void tracef(Throwable t, String format, Object... params)
+   {
+      if (isTraceEnabled()) trace(String.format(format, params), t);
+   }
+
+   /**
     * Check to see if the DEBUG level is enabled for this logger.
     *
     * @deprecated DEBUG is for low volume logging, you don't need this
@@ -229,6 +252,29 @@
    }
 
    /**
+    * Issue a formatted log message with a level of DEBUG.
+    *
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void debugf(String format, Object... params)
+   {
+      if (isDebugEnabled()) debug(String.format(format, params));
+   }
+
+   /**
+    * Issue a formatted log message with a level of DEBUG.
+    *
+    * @param t the throwable
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void debugf(Throwable t, String format, Object... params)
+   {
+      if (isDebugEnabled()) debug(String.format(format, params), t);
+   }
+
+   /**
     * Check to see if the INFO level is enabled for this logger.
     *
     * @deprecated INFO is for low volume information, you don't need this
@@ -274,6 +320,29 @@
    }
 
    /**
+    * Issue a formatted log message with a level of INFO.
+    *
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void infof(String format, Object... params)
+   {
+      if (isInfoEnabled()) info(String.format(format, params));
+   }
+
+   /**
+    * Issue a formatted log message with a level of INFO.
+    *
+    * @param t the throwable
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void infof(Throwable t, String format, Object... params)
+   {
+      if (isInfoEnabled()) info(String.format(format, params), t);
+   }
+
+   /**
     * Issue a log msg with a level of WARN.
     * 
     * @param message the message
@@ -307,6 +376,29 @@
    }
 
    /**
+    * Issue a formatted log message with a level of WARN.
+    *
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void warnf(String format, Object... params)
+   {
+      warn(String.format(format, params));
+   }
+
+   /**
+    * Issue a formatted log message with a level of WARN.
+    *
+    * @param t the throwable
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void warnf(Throwable t, String format, Object... params)
+   {
+      warn(String.format(format, params), t);
+   }
+
+   /**
     * Issue a log msg with a level of ERROR.
     * 
     * @param message the message
@@ -340,6 +432,29 @@
    }
 
    /**
+    * Issue a formatted log message with a level of ERROR.
+    *
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void errorf(String format, Object... params)
+   {
+      error(String.format(format, params));
+   }
+
+   /**
+    * Issue a formatted log message with a level of ERROR.
+    *
+    * @param t the throwable
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void errorf(Throwable t, String format, Object... params)
+   {
+      error(String.format(format, params), t);
+   }
+
+   /**
     * Issue a log msg with a level of FATAL.
     * 
     * @param message the message
@@ -373,6 +488,29 @@
    }
 
    /**
+    * Issue a formatted log message with a level of FATAL.
+    *
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void fatalf(String format, Object... params)
+   {
+      fatal(String.format(format, params));
+   }
+
+   /**
+    * Issue a formatted log message with a level of FATAL.
+    *
+    * @param t the throwable
+    * @param format the format string, as per {@link String#format(String, Object[])}
+    * @param params the parameters
+    */
+   public void fatalf(Throwable t, String format, Object... params)
+   {
+      fatal(String.format(format, params), t);
+   }
+
+   /**
     * Custom serialization to reinitalize the delegate
     * 
     * @param stream the object stream




More information about the jboss-svn-commits mailing list