consciouscode.logging
Class PrefixedLog

java.lang.Object
  extended by consciouscode.logging.AbstractLog
      extended by 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.
 
Fields inherited from class consciouscode.logging.AbstractLog
DEBUG, ERROR, FATAL, INFO, myLogLevel, NONE, TRACE, WARN
 
Constructor Summary
PrefixedLog()
           
PrefixedLog(Log targetLog)
           
 
Method Summary
protected  void doLog(int level, Object messageObj, Throwable exception)
           
protected  void doLog(String message, Throwable exception)
           
 String getMessageLabel()
           
 Log getTargetLog()
          Gets the log to which this instance is sending labeled messages.
 boolean isLoggingDebug()
           
 boolean isLoggingError()
           
protected  String labelMessage(String message)
           
 void setLoggingDebug(boolean enabled)
           
 void setLoggingError(boolean enabled)
           
 void setMessageLabel(String label)
           
 void setTargetLog(Log log)
          Sets the log to which this instance will send labeled 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
 

Field Detail

NO_OP_LOG

public static final Log NO_OP_LOG
A Log that throws away all messages.

Constructor Detail

PrefixedLog

public PrefixedLog()

PrefixedLog

public PrefixedLog(Log targetLog)
Method Detail

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.