org.schmant.report
Interface Report

All Known Implementing Classes:
AbstractPrintingReport, AbstractReport, AsynchronousReport, FileReport, MultiplexingReport, StdoutReport

public interface Report

The Report interface defines a reporting (logging, if you like) interface for Schmant scripts.

The report accepts messages with different java.util.logging.Level:s. It decides if the message should be accepted based on the internal log level (set with setLevel(Level)). The initial report log level is based on the verbosity level that Schmant was started with.

A script's default Report instance is managed by the ReportManager. It uses a ReportFactory to create the desired Report instance.

Report instances are not thread safe. It is up to those creating Schmant threads to give each thread its own Report instance. (See the ReportingThread class.)

Since:
0.5
Author:
Karl Gustafsson
See Also:
ReportManager, ReportFactory

Method Summary
 void close()
          Close the current report.
 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.
 Level getLevel()
          Get the current log level.
 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).
 boolean isDebugReported()
          Are messages to debug level (Level.FINE) logged?
 boolean isErrorReported()
          Are messages to error level (Level.SEVERE) logged?
 boolean isInfoReported()
          Are messages to info level (Level.INFO) logged?
 boolean isLevelReported(Level l)
          Are messages to the supplied Level logged?
 boolean isTraceReported()
          Are messages to trace level (Level.FINER) logged?
 boolean isWarnReported()
          Are messages to warn level (Level.WARNING) logged?
 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 setLevel(Level l)
          Set the log 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).
 

Method Detail

getIdentifier

String getIdentifier()
Get the identifier for this report. It may be null.

Returns:
This report's identifier. May be null.

trace

void trace(Object o)
Log a message to trace level (Level.FINER).

Parameters:
o - The message to log.

debug

void debug(Object o)
Log a message to debug level (Level.FINE).

Parameters:
o - The message to log.

info

void info(Object o)
Log a message to info level (Level.INFO).

Parameters:
o - The message to log.

warn

void warn(Object o)
Log a message to warn level (Level.WARNING).

Parameters:
o - The message to log.

warn

void warn(Object o,
          Throwable t)
Log a message and an exception to warn level (Level.WARNING).

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

error

void error(Object o)
Log a message to error level (Level.SEVERE).

Parameters:
o - The message to log.

error

void error(Object o,
           Throwable t)
Log a message and an exception to error level (Level.SEVERE).

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

log

void log(Object o,
         Level l)
Log a message to the supplied level.

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

log

void log(Object o,
         Throwable t,
         Level l)
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.

setLevel

void setLevel(Level l)
Set the log level.

Parameters:
l - The log level.

getLevel

Level getLevel()
Get the current log level.

Returns:
The log level.

isLevelReported

boolean isLevelReported(Level l)
Are messages to the supplied Level logged?

Parameters:
l - The level.
Returns:
true if messages to the supplied level are logged.

isTraceReported

boolean isTraceReported()
Are messages to trace level (Level.FINER) logged?

Returns:
true if messages to trace level are logged.

isDebugReported

boolean isDebugReported()
Are messages to debug level (Level.FINE) logged?

Returns:
true if messages to debug level are logged.

isInfoReported

boolean isInfoReported()
Are messages to info level (Level.INFO) logged?

Returns:
true if messages to info level are logged.

isWarnReported

boolean isWarnReported()
Are messages to warn level (Level.WARNING) logged?

Returns:
true if messages to warn level are logged.

isErrorReported

boolean isErrorReported()
Are messages to error level (Level.SEVERE) logged?

Returns:
true if messages to error level are logged.

getStackTraceWriter

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.

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.

close

void close()
Close the current report. After calling this method the report does not accept any new messages. This is called when Schmant exits or when a new report is started.