[slf4j-dev] svn commit: r132 - in slf4j/trunk: . src/filtered-java/org/slf4j src/java/org/slf4j tests tests/lib
ceki at slf4j.org
ceki at slf4j.org
Wed Jul 13 22:19:53 CEST 2005
Author: ceki
Date: Wed Jul 13 22:19:51 2005
New Revision: 132
Removed:
slf4j/trunk/tests/lib/log4j-1.2.10.jar
slf4j/trunk/tests/lib/nlog4j-1.2.12.jar
Modified:
slf4j/trunk/build.xml
slf4j/trunk/src/filtered-java/org/slf4j/LoggerFactory.java
slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java
slf4j/trunk/src/java/org/slf4j/ILoggerFactory.java
slf4j/trunk/src/java/org/slf4j/Logger.java
slf4j/trunk/src/java/org/slf4j/Marker.java
slf4j/trunk/tests/build.xml
Log:
Improved javadocs, started to add Marker specific log statements to the Logger interface
Modified: slf4j/trunk/build.xml
==============================================================================
--- slf4j/trunk/build.xml (original)
+++ slf4j/trunk/build.xml Wed Jul 13 22:19:51 2005
@@ -5,7 +5,7 @@
<property file="build.properties"/>
<!-- The directory where source files are stored. -->
- <property name="version" value="1.0-beta4"/>
+ <property name="version" value="1.0-beta5"/>
<property name="tmp.java.source.dir" value="./tmp/src"/>
<property name="tmp.javac.dest" value="./tmp/classes"/>
@@ -144,11 +144,19 @@
<copy todir="tmp/src">
<fileset dir="src/filtered-java">
<include name="**/*.java"/>
- <include name="**/package.html"/>
</fileset>
<filterset><filter token="IMPL" value="NOP"/></filterset>
+ <filterset><filter token="MARKER_FACTORY_IMPL_PREFIX"
+ value="Basic"/>
+ </filterset>
</copy>
+ <copy todir="tmp/src">
+ <fileset dir="src/java">
+ <include name="**/*.java"/>
+ <include name="**/*.html"/>
+ </fileset>
+ </copy>
<mkdir dir="${javadoc.dest}" />
Modified: slf4j/trunk/src/filtered-java/org/slf4j/LoggerFactory.java
==============================================================================
--- slf4j/trunk/src/filtered-java/org/slf4j/LoggerFactory.java (original)
+++ slf4j/trunk/src/filtered-java/org/slf4j/LoggerFactory.java Wed Jul 13 22:19:51 2005
@@ -37,16 +37,27 @@
// WARNING
/**
- * The <code>LoggerFactory</code> can produce Loggers for various logging APIs,
- * most notably for log4j, JDK 1.4 logging. Other implemenations such as
- * {@link org.slf4j.impl.NOPLogger NOPLogger} and
+ * The <code>LoggerFactory</code> is a utility class producing Loggers
+ * for various logging APIs, most notably for NLOG4J and JDK 1.4 logging.
+ * Other implemenations such as {@link org.slf4j.impl.NOPLogger NOPLogger} and
* {@link org.slf4j.impl.SimpleLogger SimpleLogger} are also supported.
*
+ * <p><code>LoggerFactory</code> is essentially a wrapper around an
+ * {@link ILoggerFactory} instance bound with <code>LoggerFactory</code>
+ * at compile time.
+ *
+ * <p>Please note that all methods in <code>LoggerFactory</code> are
+ * static.
+ *
* @author Ceki Gülcü
*/
-public class LoggerFactory {
+public final class LoggerFactory {
static ILoggerFactory loggerFactory;
+ // private constructor prevents instantiation
+ private LoggerFactory() {
+ }
+
//
// WARNING Do not modify copies but the original in
// $SLF4J_HOME/src/filtered-java/org/slf4j/
@@ -74,7 +85,7 @@
}
/**
- * Fetch the appropriate adapter as intructed by the system propties.
+ * Fetch the appropriate ILoggerFactory as intructed by the system propties.
*
* @return The appropriate ILoggerFactory instance as directed from the
* system properties
@@ -114,7 +125,8 @@
/**
* Return a logger named according to the name parameter using the
- * previously bound {@link LoggerFactoryAdapter adapter}.
+ * statically bound {@link ILoggerFactory} instance.
+ *
* @param name The name of the logger.
* @return logger
*/
@@ -122,6 +134,13 @@
return loggerFactory.getLogger(name);
}
+ /**
+ * Return a logger named corresponding to the class passed as parameter,
+ * using the statically bound {@link ILoggerFactory} instance.
+ *
+ * @param clazz the returned logger will be named after clazz
+ * @return logger
+ */
public static Logger getLogger(Class clazz) {
return loggerFactory.getLogger(clazz.getName());
}
Modified: slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java
==============================================================================
--- slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java (original)
+++ slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java Wed Jul 13 22:19:51 2005
@@ -38,14 +38,22 @@
/**
- * A static MarkerFactory bound to a specific {@link IMarkerFactory} instance at
- * at compile time.
+ * MarkerFactory is a utility class producing Marker instances as appropriate
+ * for each logging systems.
+ *
+ * MarkerFactory is essentially a wrapper around an IMarkerFactory instance
+ * bound with the MarkerFactory class at compile time.
+ *
+ * Please note that all methods in MarkerFactory are static.
*
* @author Ceki Gulcu
*/
public class MarkerFactory {
static IMarkerFactory markerFactory;
+ private MarkerFactory() {
+ }
+
//
// WARNING Do not modify copies but the original at
// $SLF4J_HOME/src/filtered-java/org/slf4j/
@@ -59,14 +67,14 @@
Util.reportFailure(
"Could not instantiate instance of class [" + markerFactoryClassStr + "]",
e);
- }
-
+ }
}
/**
* Return a Marker instnace as specified by the name parameter using the
- * previously bound {@link IMakerFactory marker factory instance}.
- * @param name The name of the Marker.
+ * previously bound {@link IMarkerFactory} instance.
+ *
+ * @param name The name of the {@link Marker} object to return.
* @return marker
*/
public static Marker getMarker(String name) {
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 Wed Jul 13 22:19:51 2005
@@ -34,6 +34,9 @@
/**
+ * Implementaitons of this interface are used to manufacture {@link Logger}
+ * instances.
+ *
* ILoggerFactory interface is used internally by {@link
* LoggerFactory}.
*
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 Wed Jul 13 22:19:51 2005
@@ -56,6 +56,14 @@
*/
public void debug(String msg);
+
+ /**
+ * Log a message with the specific Marker at the DEBUG level.
+ *
+ * @param marker The marker specific for this log statement
+ * @param msg the message string to be logged
+ */
+ public void debug(Marker marker, String msg);
/**
* Log a message at the DEBUG level according to the specified format
Modified: slf4j/trunk/src/java/org/slf4j/Marker.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/Marker.java (original)
+++ slf4j/trunk/src/java/org/slf4j/Marker.java Wed Jul 13 22:19:51 2005
@@ -35,13 +35,47 @@
import java.util.Iterator;
+/**
+ * Markers are named objects which can be used to enrich log statements.
+ *
+ * <p>Markers can contain child markers which can contain children of their
+ * own.
+ *
+ * @author Ceki Gulcu
+ */
public interface Marker {
+ /**
+ * Get the name of this Marker.
+ * @return name of marker
+ */
public String getName();
+ /**
+ * Add a child Marker to this Marker.
+ * @param child a child marker
+ */
public void add(Marker child);
+
+ /**
+ * Remove a child Marker.
+ * @param child the child Marker to remove
+ * @return true if child could be found and removed, false otherwise.
+ */
public boolean remove(Marker child);
+
+ /**
+ * Does this marker have children?
+ * @return true if this marker has children, false otherwise.
+ */
public boolean hasChildren();
+
+ /**
+ * Returns an Iterator which can be used to iterator over the children of this
+ * marker. An empty iterator is returned when this marker has no children.
+ *
+ * @return Iterator over the children of this marker
+ */
public Iterator iterator();
// void makeImmutable();
Modified: slf4j/trunk/tests/build.xml
==============================================================================
--- slf4j/trunk/tests/build.xml (original)
+++ slf4j/trunk/tests/build.xml Wed Jul 13 22:19:51 2005
@@ -27,15 +27,15 @@
<pathelement location="../slf4j-simple.jar"/>
</path>
- <path id="jdk14.classpath">
+ <path id="jdk14.classpath">
<path refid="basic.classpath"/>
<pathelement location="../slf4j-jdk14.jar"/>
</path>
- <path id="nlog4j1212.classpath">
+ <path id="nlog4j12x.classpath">
<path refid="basic.classpath"/>
- <fileset dir="lib">
- <include name="nlog4j-1.2.12.jar"/>
+ <fileset dir="./lib/">
+ <include name="nlog4j*.jar"/>
</fileset>
</path>
@@ -107,7 +107,7 @@
InvokeNOP,
InvokeSimple,
InvokeJDK14,
- InvokeNLOG4J1212"
+ InvokeNLOG4J12x"
/>
<target name="MessageFormatter" depends="build, cleanOutputDir">
@@ -143,10 +143,10 @@
</target>
- <target name="InvokeNLOG4J1212" depends="build, cleanOutputDir">
- <copy file="input/nlog4j1212/basic.xml" tofile="${tests.javac.dest}/log4j.xml"/>
+ <target name="InvokeNLOG4J12x" depends="build, cleanOutputDir">
+ <copy file="input/nlog4j12x/basic.xml" tofile="${tests.javac.dest}/log4j.xml"/>
<junit printsummary="yes" fork="yes" haltonfailure="yes">
- <classpath refid="nlog4j1212.classpath"/>
+ <classpath refid="nlog4j12x.classpath"/>
<formatter type="plain" usefile="false"/>
<test name="org.slf4j.InvokingSLF4J" />
</junit>
More information about the slf4j-dev
mailing list