Author: ceki Date: Sat Aug 13 15:18:48 2005 New Revision: 162 Modified: nlog4j/trunk/src/java/org/slf4j/Constants.java nlog4j/trunk/src/java/org/slf4j/Logger.java nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java Log:
Updated to the latest SLF4J version from the SVN repository (only javadoc and minor changes from last update) Modified: nlog4j/trunk/src/java/org/slf4j/Constants.java ============================================================================== --- nlog4j/trunk/src/java/org/slf4j/Constants.java (original) +++ nlog4j/trunk/src/java/org/slf4j/Constants.java Sat Aug 13 15:18:48 2005 @@ -34,22 +34,20 @@ /** * Various constants used in the SLF4J API. + * + * @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a> */ public interface Constants { /** * The name of the system property to set in order to instruct * [EMAIL PROTECTED] LoggerFactory} class to use a specific ILoggerFactory. - * <p> - * This constant is currently set to the value "org.slf4j.factory". */ final public static String LOGGER_FACTORY_PROPERTY = "org.slf4j.factory"; /** * Constant used to determine the name of the factory method for * creating logger factories. - * <p> - * This constant currently is set to the value "getInstance". */ final public static String LOGGER_FACTORY_FACTORY_METHOD_NAME = "getInstance"; } Modified: nlog4j/trunk/src/java/org/slf4j/Logger.java ============================================================================== --- nlog4j/trunk/src/java/org/slf4j/Logger.java (original) +++ nlog4j/trunk/src/java/org/slf4j/Logger.java Sat Aug 13 15:18:48 2005 @@ -35,13 +35,18 @@ /** * * The main user interface to logging. It is expected that logging - * takes places through concrete implementations of the Logger - * interface. + * takes place through concrete implementations of this interface. * - * @author Ceki Gülcü + * @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a> */ public interface Logger { + + /** + * Return the name of this <code>Logger</code> instance. + */ + public String getName(); + /** * Is the logger instance enabled for the DEBUG level? * @return True if this Logger is enabled for the DEBUG level, @@ -49,7 +54,14 @@ */ public boolean isDebugEnabled(); + /** + * Similar to [EMAIL PROTECTED] #isDebugEnabled()} method except that the + * marker data is also taken into account. + * + * @param marker The marker data to take into consideration + */ public boolean isDebugEnabled(Marker marker); + /** * Log a message at the DEBUG level. * @@ -59,14 +71,6 @@ /** - * 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 * and argument. * @@ -78,7 +82,7 @@ */ 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 @@ -93,9 +97,6 @@ */ 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 * accompanying message. @@ -104,9 +105,49 @@ * @param t the exception (throwable) to log */ public void debug(String msg, Throwable t); + + /** + * Log a message with the specific Marker at the DEBUG level. + * + * @param marker the marker data specific to this log statement + * @param msg the message string to be logged + */ + public void debug(Marker marker, String msg); + + /** + * This method is similar to [EMAIL PROTECTED] #debug(String, Object)} method except that the + * marker data is also taken into consideration. + * + * @param marker the marker data specific to this log statement + * @param format the format string + * @param arg the argument + */ + public void debug(Marker marker, String format, Object arg); + + + /** + * This method is similar to [EMAIL PROTECTED] #debug(String, Object, Object)} + * method except that the marker data is also taken into + * consideration. + * + * @param marker the marker data specific to this log statement + * @param format the format string + * @param arg1 the first argument + * @param arg2 the second argument + */ + public void debug(Marker marker, String format, Object arg1, Object arg2); + /** + * This method is similar to [EMAIL PROTECTED] #debug(String, Throwable)} method except that the + * marker data is also taken into consideration. + * + * @param marker the marker data specific to this log statement + * @param msg the message accompanying the exception + * @param t the exception (throwable) to log + */ 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, @@ -114,6 +155,13 @@ */ public boolean isInfoEnabled(); + + /** + * Similar to [EMAIL PROTECTED] #isInfoEnabled()} method except that the marker + * data is also taken into consideration. + * + * @param marker The marker data to take into consideration + */ public boolean isInfoEnabled(Marker marker); /** @@ -123,8 +171,6 @@ */ public void info(String msg); - public void info(Marker marker, String msg); - /** * Log a message at the INFO level according to the specified format @@ -138,6 +184,7 @@ */ public void info(String format, Object arg); + /** * Log a message at the INFO level according to the specified format * and arguments. @@ -160,8 +207,44 @@ */ public void info(String msg, Throwable t); + /** + * Log a message with the specific Marker at the INFO level. + * + * @param marker The marker specific to this log statement + * @param msg the message string to be logged + */ + public void info(Marker marker, String msg); + + /** + * This method is similar to [EMAIL PROTECTED] #info(String, Object)} method except that the + * marker data is also taken into consideration. + * + * @param marker the marker data specific to this log statement + * @param format the format string + * @param arg the argument + */ public void info(Marker marker, String format, Object arg); + + /** + * This method is similar to [EMAIL PROTECTED] #debug(String, Object, Object)} + * method except that the marker data is also taken into + * consideration. + * + * @param marker the marker data specific to this log statement + * @param format the format string + * @param arg1 the first argument + * @param arg2 the second argument + */ public void info(Marker marker, String format, Object arg1, Object arg2); + + /** + * This method is similar to [EMAIL PROTECTED] #info(String, Throwable)} method + * except that the marker data is also taken into consideration. + * + * @param marker the marker data for this log statement + * @param msg the message accompanying the exception + * @param t the exception (throwable) to log + */ public void info(Marker marker, String msg, Throwable t); @@ -203,7 +286,7 @@ * @param arg2 the second argument */ public void warn(String format, Object arg1, Object arg2); - + /** * Log an exception (throwable) at the WARN level with an * accompanying message. @@ -212,12 +295,57 @@ * @param t the exception (throwable) to log */ public void warn(String msg, Throwable t); - + + /** + * Similar to [EMAIL PROTECTED] #isWarnEnabled()} method except that the marker + * data is also taken into consideration. + * + * @param marker The marker data to take into consideration + */ + public boolean isWarnEnabled(Marker marker); + + /** + * Log a message with the specific Marker at the WARN level. + * + * @param marker The marker specific to this log statement + * @param msg the message string to be logged + */ public void warn(Marker marker, String msg); + + /** + * This method is similar to [EMAIL PROTECTED] #warn(String, Object)} method except that the + * marker data is also taken into consideration. + * + * @param marker the marker data specific to this log statement + * @param format the format string + * @param arg the argument + */ public void warn(Marker marker, String format, Object arg); + + /** + * This method is similar to [EMAIL PROTECTED] #debug(String, Object, Object)} + * method except that the marker data is also taken into + * consideration. + * + * @param marker the marker data specific to this log statement + * @param format the format string + * @param arg1 the first argument + * @param arg2 the second argument + */ public void warn(Marker marker, String format, Object arg1, Object arg2); + + + /** + * This method is similar to [EMAIL PROTECTED] #warn(String, Throwable)} method + * except that the marker data is also taken into consideration. + * + * @param marker the marker data for this log statement + * @param msg the message accompanying the exception + * @param t the exception (throwable) to log + */ public void warn(Marker marker, String msg, Throwable t); - public boolean isWarnEnabled(Marker marker); + + /** * Is the logger instance enabled for the ERROR level? @@ -225,14 +353,14 @@ * false otherwise. */ public boolean isErrorEnabled(); - + /** * Log a message at the ERROR level. * * @param msg the message string to be logged */ public void error(String msg); - + /** * Log a message at the ERROR level according to the specified format * and argument. @@ -267,10 +395,55 @@ */ public void error(String msg, Throwable t); + /** + * Similar to [EMAIL PROTECTED] #isErrorEnabled()} method except that the + * marker data is also taken into consideration. + * + * @param marker The marker data to take into consideration + */ + public boolean isErrorEnabled(Marker marker); + + /** + * Log a message with the specific Marker at the ERROR level. + * + * @param marker The marker specific to this log statement + * @param msg the message string to be logged + */ public void error(Marker marker, String msg); + + /** + * This method is similar to [EMAIL PROTECTED] #error(String, Object)} method except that the + * marker data is also taken into consideration. + * + * @param marker the marker data specific to this log statement + * @param format the format string + * @param arg the argument + */ public void error(Marker marker, String format, Object arg); + + /** + * This method is similar to [EMAIL PROTECTED] #debug(String, Object, Object)} + * method except that the marker data is also taken into + * consideration. + * + * @param marker the marker data specific to this log statement + * @param format the format string + * @param arg1 the first argument + * @param arg2 the second argument + */ 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); + + + /** + * This method is similar to [EMAIL PROTECTED] #error(String, Throwable)} + * method except that the marker data is also taken into + * consideration. + * + * @param marker the marker data specific to this log statement + * @param msg the message accompanying the exception + * @param t the exception (throwable) to log + */ + public void error(Marker marker, String msg, Throwable t); + } Modified: nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java ============================================================================== --- nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java (original) +++ nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java Sat Aug 13 15:18:48 2005 @@ -49,7 +49,7 @@ * <p>Please note that all methods in <code>LoggerFactory</code> are * static. * - * @author Ceki Gülcü + * @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a> */ public final class LoggerFactory { static ILoggerFactory loggerFactory; @@ -144,4 +144,17 @@ public static Logger getLogger(Class clazz) { return loggerFactory.getLogger(clazz.getName()); } + + /** + * Return the [EMAIL PROTECTED] ILoggerFactory} instance in use. + * + * <p>Usually, the ILoggerFactory instance is bound with this class + * at compile time. + * + * @return the ILoggerFactory instance in use + */ + public static ILoggerFactory getILoggerFactory() { + return loggerFactory; + } + } Modified: nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java ============================================================================== --- nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java (original) +++ nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java Sat Aug 13 15:18:48 2005 @@ -40,7 +40,7 @@ /** * A direct NOP (no operation) implementation of [EMAIL PROTECTED] Logger}. * - * @author Ceki Gülcü + * @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a> */ public final class NOPLogger implements Logger { /** @@ -56,6 +56,13 @@ } /** + * Always returns the string value "NOP". + */ + public String getName() { + return "NOP"; + } + + /** * Always returns false. * @return always false */ Modified: nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java ============================================================================== --- nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java (original) +++ nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java Sat Aug 13 15:18:48 2005 @@ -60,7 +60,7 @@ 467 [main] INFO examples.Sort - Exiting main method. </pre> * - * @author Ceki Gülcü + * @author <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a> */ public class SimpleLogger implements Logger { /** @@ -72,16 +72,19 @@ private static String INFO_STR = "INFO"; private static String WARN_STR = "WARN"; private static String ERROR_STR = "ERROR"; - String loggerName; + String name; /** * Package access allows only [EMAIL PROTECTED] SimpleLoggerFactory} to instantiate * SimpleLogger instances. */ SimpleLogger(String name) { - this.loggerName = name; + this.name = name; } + public String getName() { + return name; + } /** * Always returns false. * @return always false @@ -166,7 +169,7 @@ buf.append(level); buf.append(" "); - buf.append(loggerName); + buf.append(name); buf.append(" - "); buf.append(message); _______________________________________________ nlog4j-dev mailing list [email protected] http://slf4j.org/mailman/listinfo/nlog4j-dev
