consciouscode.logging
Class PrefixedLog
java.lang.Object
consciouscode.logging.AbstractLog
consciouscode.logging.PrefixedLog
- All Implemented Interfaces:
- Log
public class PrefixedLog
- extends AbstractLog
Log
implementation that prefixes each message before sending it on
to a target log.
Field Summary |
static Log |
NO_OP_LOG
A Log that throws away all messages. |
Methods inherited from class consciouscode.logging.AbstractLog |
debug, debug, error, error, fatal, fatal, info, info, isDebugEnabled, isErrorEnabled, isFatalEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, setLogLevel, trace, trace, warn, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NO_OP_LOG
public static final Log NO_OP_LOG
- A Log that throws away all messages.
PrefixedLog
public PrefixedLog()
PrefixedLog
public PrefixedLog(Log targetLog)
getMessageLabel
public String getMessageLabel()
setMessageLabel
public void setMessageLabel(String label)
getTargetLog
public Log getTargetLog()
- Gets the log to which this instance is sending labeled messages.
- Returns:
- a valid log, not
null
.
setTargetLog
public void setTargetLog(Log log)
- Sets the log to which this instance will send labeled messages.
isLoggingDebug
public final boolean isLoggingDebug()
setLoggingDebug
public void setLoggingDebug(boolean enabled)
isLoggingError
public final boolean isLoggingError()
setLoggingError
public void setLoggingError(boolean enabled)
doLog
protected void doLog(int level,
Object messageObj,
Throwable exception)
- Overrides:
doLog
in class AbstractLog
doLog
protected void doLog(String message,
Throwable exception)
- Specified by:
doLog
in class AbstractLog
labelMessage
protected String labelMessage(String message)
Copyright © 2001–2012
Todd V. Jonker. All Rights Reserved.