consciouscode.logging
Class PrintLog
java.lang.Object
consciouscode.logging.AbstractLog
consciouscode.logging.PrintLog
- All Implemented Interfaces:
- Log
- Direct Known Subclasses:
- FileLog
public class PrintLog
- extends AbstractLog
Log
implementation that sends all messages to a PrintWriter
.
Messages may optionally be prefixed by a timestamp; this is configured by
calling setTimestampPattern(java.lang.String)
.
Methods inherited from class consciouscode.logging.AbstractLog |
debug, debug, doLog, 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 |
PrintLog
public PrintLog()
- Constructs a log that sends all messages to
System.out
.
PrintLog
public PrintLog(PrintWriter writer)
PrintLog
public PrintLog(PrintStream stream)
setPrintWriter
public void setPrintWriter(PrintWriter writer)
- Replace the PrintWriter that receives logging messages.
getTimestampPattern
public String getTimestampPattern()
- Get the pattern used to format message timestamps, or null if timestamps
are not being logged. By default, the pattern is null.
setTimestampPattern
public void setTimestampPattern(String pattern)
- Set the pattern used to format message timestamps.
- Parameters:
pattern
- is a date-time format a specified by
SimpleDateFormat
. If null, no timestamp will be logged.
doLog
protected void doLog(String message,
Throwable exception)
- Specified by:
doLog
in class AbstractLog
Copyright © 2001–2012
Todd V. Jonker. All Rights Reserved.