org.jfree.util

Class PrintStreamLogTarget

Implemented Interfaces:
LogTarget, Serializable

public class PrintStreamLogTarget
extends java.lang.Object
implements LogTarget, Serializable

A log target that sends output to a PrintStream.
Author:
Thomas Morgner

Fields inherited from interface org.jfree.util.LogTarget

DEBUG, ERROR, INFO, LEVELS, WARN

Constructor Summary

PrintStreamLogTarget()
The default constructor.
PrintStreamLogTarget(PrintStream printStream)
The default constructor.

Method Summary

void
log(int level, Object message)
Logs a message to the main log stream.
void
log(int level, Object message, Exception e)
logs an message to the main-log stream.

Constructor Details

PrintStreamLogTarget

public PrintStreamLogTarget()
The default constructor. Initializes this target with the system.out stream.

All LogTarget implementations need a default constructor.


PrintStreamLogTarget

public PrintStreamLogTarget(PrintStream printStream)
The default constructor. Initializes this target with the given stream.

Parameters:
printStream - the print stream that is used to write the content.

Method Details

log

public void log(int level,
                Object message)
Logs a message to the main log stream. All attached logStreams will also receive this message. If the given log-level is higher than the given debug-level in the main config file, no logging will be done.
Specified by:
log in interface LogTarget
Parameters:
level - log level of the message.
message - text to be logged.

log

public void log(int level,
                Object message,
                Exception e)
logs an message to the main-log stream. All attached logStreams will also receive this message. If the given log-level is higher than the given debug-level in the main config file, no logging will be done. The exception's stacktrace will be appended to the log-stream
Specified by:
log in interface LogTarget
Parameters:
level - log level of the message.
message - text to be logged.
e - the exception, which should be logged.