adding isDebugEnabled and isInfoEnabled per Ceki's suggestion
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138808 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -11,7 +11,7 @@ package org.apache.commons.httpclient.log;
|
|||||||
/**
|
/**
|
||||||
* A simple logging interface abstracting log4j.
|
* A simple logging interface abstracting log4j.
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @version $Id: Log.java,v 1.1 2001/08/02 16:27:06 rwaldhoff Exp $
|
* @version $Id: Log.java,v 1.2 2001/08/02 22:14:41 rwaldhoff Exp $
|
||||||
*/
|
*/
|
||||||
public interface Log {
|
public interface Log {
|
||||||
public void assert(boolean assertion, String msg);
|
public void assert(boolean assertion, String msg);
|
||||||
@@ -25,4 +25,6 @@ public interface Log {
|
|||||||
public void error(Object message, Throwable t);
|
public void error(Object message, Throwable t);
|
||||||
public void fatal(Object message);
|
public void fatal(Object message);
|
||||||
public void fatal(Object message, Throwable t);
|
public void fatal(Object message, Throwable t);
|
||||||
|
public boolean isDebugEnabled();
|
||||||
|
public boolean isInfoEnabled();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,11 @@
|
|||||||
package org.apache.commons.httpclient.log;
|
package org.apache.commons.httpclient.log;
|
||||||
|
|
||||||
import org.apache.log4j.Category;
|
import org.apache.log4j.Category;
|
||||||
|
import org.apache.log4j.Priority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @version $Id: Log4JCategoryLog.java,v 1.1 2001/08/02 16:27:06 rwaldhoff Exp $
|
* @version $Id: Log4JCategoryLog.java,v 1.2 2001/08/02 22:14:41 rwaldhoff Exp $
|
||||||
*/
|
*/
|
||||||
public class Log4JCategoryLog implements Log {
|
public class Log4JCategoryLog implements Log {
|
||||||
Category _category = null;
|
Category _category = null;
|
||||||
@@ -63,4 +64,16 @@ public class Log4JCategoryLog implements Log {
|
|||||||
public final void fatal(Object message, Throwable t) {
|
public final void fatal(Object message, Throwable t) {
|
||||||
_category.fatal(message,t);
|
_category.fatal(message,t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isDebugEnabled() {
|
||||||
|
return _category.isDebugEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isInfoEnabled() {
|
||||||
|
return _category.isInfoEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isEnabledFor(Priority p) {
|
||||||
|
return _category.isEnabledFor(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ package org.apache.commons.httpclient.log;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @version $Id: NoOpLog.java,v 1.1 2001/08/02 16:27:06 rwaldhoff Exp $
|
* @version $Id: NoOpLog.java,v 1.2 2001/08/02 22:14:41 rwaldhoff Exp $
|
||||||
*/
|
*/
|
||||||
public final class NoOpLog implements Log {
|
public final class NoOpLog implements Log {
|
||||||
public NoOpLog() { }
|
public NoOpLog() { }
|
||||||
@@ -26,4 +26,6 @@ public final class NoOpLog implements Log {
|
|||||||
public void error(Object message, Throwable t) { }
|
public void error(Object message, Throwable t) { }
|
||||||
public void fatal(Object message) { }
|
public void fatal(Object message) { }
|
||||||
public void fatal(Object message, Throwable t) { }
|
public void fatal(Object message, Throwable t) { }
|
||||||
|
public final boolean isDebugEnabled() { return false; }
|
||||||
|
public final boolean isInfoEnabled() { return false; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @version $Id: SimpleLog.java,v 1.1 2001/08/02 16:27:06 rwaldhoff Exp $
|
* @version $Id: SimpleLog.java,v 1.2 2001/08/02 22:14:41 rwaldhoff Exp $
|
||||||
*/
|
*/
|
||||||
public class SimpleLog implements Log {
|
public class SimpleLog implements Log {
|
||||||
static protected final Properties _simplelogProps = new Properties();
|
static protected final Properties _simplelogProps = new Properties();
|
||||||
@@ -162,4 +162,12 @@ public class SimpleLog implements Log {
|
|||||||
public final void fatal(Object message, Throwable t) {
|
public final void fatal(Object message, Throwable t) {
|
||||||
log(FATAL,message,t);
|
log(FATAL,message,t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isDebugEnabled() {
|
||||||
|
return (_logLevel >= DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isInfoEnabled() {
|
||||||
|
return (_logLevel >= INFO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user