[slf4j-dev] svn commit: r1018 - slf4j/trunk/slf4j-api/src/main/java/org/slf4j

ceki at slf4j.org ceki at slf4j.org
Tue May 27 22:04:40 CEST 2008


Author: ceki
Date: Tue May 27 22:04:40 2008
New Revision: 1018

Modified:
   slf4j/trunk/slf4j-api/src/main/java/org/slf4j/Logger.java

Log:
Added typical usage pattern to the javadoc. This was requested in bug 77.

Modified: slf4j/trunk/slf4j-api/src/main/java/org/slf4j/Logger.java
==============================================================================
--- slf4j/trunk/slf4j-api/src/main/java/org/slf4j/Logger.java	(original)
+++ slf4j/trunk/slf4j-api/src/main/java/org/slf4j/Logger.java	Tue May 27 22:04:40 2008
@@ -26,10 +26,33 @@
 package org.slf4j;
 
 /**
- * 
  * The main user interface to logging. It is expected that logging
  * takes place through concrete implementations of this interface.
+ *
+ * <h3>Typical usage pattern:</h3>
+ * <pre>
+ * import org.slf4j.Logger;
+ * import org.slf4j.LoggerFactory;
  * 
+ * public class Wombat {
+ *
+ *   <span style="color:green">final static Logger logger = LoggerFactory.getLogger(Wombat.class);</span>
+ *   Integer t;
+ *   Integer oldT;
+ *
+ *   public void setTemperature(Integer temperature) {
+ *     oldT = t;        
+ *     t = temperature;
+ *     <span style="color:green">logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT);</span>
+ *     if(temperature.intValue() > 50) {
+ *       <span style="color:green">logger.info("Temperature has risen above 50 degrees.");</span>
+ *     }
+ *   }
+ * }
+ </pre>
+
+
+ 
  * @author Ceki G&uuml;lc&uuml;
  */
 public interface Logger {



More information about the slf4j-dev mailing list