com.devsphere.logging
Class PrintLogger

java.lang.Object
  |
  +--com.devsphere.logging.AbstractLogger
        |
        +--com.devsphere.logging.PrintLogger

public class PrintLogger
extends AbstractLogger

Logging mechanisms that uses a print stream or a writer.

See Also:
AbstractLogger

Constructor Summary
PrintLogger(java.io.PrintStream stream)
          Creates the print logger.
PrintLogger(java.io.PrintWriter writer)
          Creates the print logger.
 
Method Summary
 void close()
          Closes the output stream / writer that is used by this logger.
 void flush()
          Flushes the output stream / writer that is used by this logger.
 void log(java.lang.String message)
          Logs a message.
 void log(java.lang.String message, java.lang.Throwable throwable)
          Logs a message and an exception.
 void log(java.lang.Throwable throwable)
          Logs an exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintLogger

public PrintLogger(java.io.PrintStream stream)
Creates the print logger.
Parameters:
stream - the output stream used for logging.
Throws:
NullPointerException - if stream is null.

PrintLogger

public PrintLogger(java.io.PrintWriter writer)
Creates the print logger.
Parameters:
writer - the writer used for logging.
Throws:
NullPointerException - if writer is null.
Method Detail

log

public void log(java.lang.String message)
Logs a message.
Overrides:
log in class AbstractLogger
Parameters:
message - the message that has to be logged.

log

public void log(java.lang.Throwable throwable)
Logs an exception.
Overrides:
log in class AbstractLogger
Parameters:
throwable - the exception that has to be logged.

log

public void log(java.lang.String message,
                java.lang.Throwable throwable)
Logs a message and an exception.
Overrides:
log in class AbstractLogger
Parameters:
message - the message that has to be logged.
throwable - the exception that has to be logged.

flush

public void flush()
Flushes the output stream / writer that is used by this logger.
Overrides:
flush in class AbstractLogger

close

public void close()
Closes the output stream / writer that is used by this logger. The System.out and System.err streams are not closed by this method.
Overrides:
close in class AbstractLogger