Class Logger.WriterLoggerTarget
java.lang.Object
|
+--Logger.WriterLoggerTarget
- All Implemented Interfaces:
- Logger.LoggerTarget
- Enclosing class:
- Logger
- public static class Logger.WriterLoggerTarget
- extends java.lang.Object
- implements Logger.LoggerTarget
This class implements the LoggerTarget interface, writing log entries
to a Writer. It is a simple example of a LoggerTarget that is used by
the Tester class below, and can also be used by clients outside of the
Logger class.
Method Summary |
java.io.Writer |
getWriter()
Get the Writer that messages are currently being logged to. |
void |
log(Logger.Entry entry)
Log the log entry to the Writer. |
void |
setWriter(java.io.Writer writer)
Set the Writer to write log entries to. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Logger.WriterLoggerTarget
public Logger.WriterLoggerTarget(java.io.Writer writer)
- Constructor.
- Parameters:
writer
- The Writer to write log entries to.- Throws:
Exceptions
- None.
setWriter
public void setWriter(java.io.Writer writer)
- Set the Writer to write log entries to. If null, no logging to a
Writer is performed.
- Parameters:
writer
- The new Writer.- Returns:
- None.
- Throws:
Exceptions
- None.
getWriter
public java.io.Writer getWriter()
- Get the Writer that messages are currently being logged to.
- Returns:
- The Writer.
- Throws:
Exceptions
- None.
log
public void log(Logger.Entry entry)
throws java.io.IOException
- Log the log entry to the Writer.
- Specified by:
log
in interface Logger.LoggerTarget
- Parameters:
entry
- The log entry to write to the log.- Returns:
- None.
- Throws:
java.io.IOException
-