org.schmant.report
Class MultiplexingReport

java.lang.Object
  extended by org.schmant.report.AbstractReport
      extended by org.schmant.report.MultiplexingReport
All Implemented Interfaces:
Report

public class MultiplexingReport
extends AbstractReport

This is a Report that writes its output to one or more other Report:s.

This Report has its own reporting level, so it may block logging requests that otherwise would have been logged by the Report:s it logs to.

Since:
0.6
Author:
Karl Gustafsson

Constructor Summary
MultiplexingReport(Level l, Report... reports)
           
MultiplexingReport(Report... reports)
          Create a new multiplexing report that will log its output to the supplied Report objects.
 
Method Summary
 void debug(Object o)
          Log a message to debug level (Level.FINE).
 void error(Object o)
          Log a message to error level (Level.SEVERE).
 void error(Object o, Throwable t)
          Log a message and an exception to error level (Level.SEVERE).
 String getIdentifier()
          Get the identifier for this report.
 PrintWriter getStackTraceWriter(Level l)
          Get a PrintWriter to write a stack trace to if the stack trace for some reason cannot be logged through any of the ordinary logger methods.
 void info(Object o)
          Log a message to info level (Level.INFO).
 void log(Object o, Level l)
          Log a message to the supplied level.
 void log(Object o, Throwable t, Level l)
          Log a message and an exception to the supplied level.
 void trace(Object o)
          Log a message to trace level (Level.FINER).
 void warn(Object o)
          Log a message to warn level (Level.WARNING).
 void warn(Object o, Throwable t)
          Log a message and an exception to warn level (Level.WARNING).
 
Methods inherited from class org.schmant.report.AbstractReport
close, getLevel, isDebugReported, isErrorReported, isInfoReported, isLevelReported, isOpen, isTraceReported, isWarnReported, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplexingReport

public MultiplexingReport(Report... reports)
Create a new multiplexing report that will log its output to the supplied Report objects. The initial log level is Level.INFO.

Parameters:
reports - The reports to log to.

MultiplexingReport

public MultiplexingReport(Level l,
                          Report... reports)
Method Detail

getIdentifier

public String getIdentifier()
Description copied from interface: Report
Get the identifier for this report. It may be null.

Returns:
null, always.

trace

public void trace(Object o)
Description copied from interface: Report
Log a message to trace level (Level.FINER).

Parameters:
o - The message to log.

debug

public void debug(Object o)
Description copied from interface: Report
Log a message to debug level (Level.FINE).

Parameters:
o - The message to log.

info

public void info(Object o)
Description copied from interface: Report
Log a message to info level (Level.INFO).

Parameters:
o - The message to log.

warn

public void warn(Object o)
Description copied from interface: Report
Log a message to warn level (Level.WARNING).

Parameters:
o - The message to log.

warn

public void warn(Object o,
                 Throwable t)
Description copied from interface: Report
Log a message and an exception to warn level (Level.WARNING).

Parameters:
o - The message to log.
t - The exception to log.

error

public void error(Object o)
Description copied from interface: Report
Log a message to error level (Level.SEVERE).

Parameters:
o - The message to log.

error

public void error(Object o,
                  Throwable t)
Description copied from interface: Report
Log a message and an exception to error level (Level.SEVERE).

Parameters:
o - The message to log.
t - The exception to log.

log

public void log(Object o,
                Level l)
Description copied from interface: Report
Log a message to the supplied level.

Parameters:
o - The message to log.
l - The level to log to.

log

public void log(Object o,
                Throwable t,
                Level l)
Description copied from interface: Report
Log a message and an exception to the supplied level.

Parameters:
o - The message to log. This may be null.
t - The exception to log. This may be null.
l - The level to log to.

getStackTraceWriter

public PrintWriter getStackTraceWriter(Level l)
Description copied from interface: Report
Get a PrintWriter to write a stack trace to if the stack trace for some reason cannot be logged through any of the ordinary logger methods.

The caller is responsible for closing the writer.

Parameters:
l - The level to write the stack trace to.
Returns:
A print writer to write a stack trace to.