org.schmant.report
Class SimpleReportLineFormatter

java.lang.Object
  extended by org.schmant.report.SimpleReportLineFormatter
All Implemented Interfaces:
ReportLineFormatter

public class SimpleReportLineFormatter
extends Object
implements ReportLineFormatter

This is the default LogLineFormatter.

If the schmant.SimpleReportLineFormatter.logTimestamp system property is set to true, a timestamp will be logged at each row.

Since:
0.6
Author:
Karl Gustafsson

Constructor Summary
SimpleReportLineFormatter()
           
 
Method Summary
 String formatLine(String reportIdentifier, String severity, String msg)
          Format one log line.
 String formatStackTrace(String reportIdentifier, String severity, Throwable t)
          Format a log message containing a stack trace.
 boolean isLogTimestamp()
          Is a timestamp logged with each log message?
 void setLogTimestamp(boolean b)
          Should a timestamp be logged with each log message?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleReportLineFormatter

public SimpleReportLineFormatter()
Method Detail

setLogTimestamp

public void setLogTimestamp(boolean b)
Should a timestamp be logged with each log message?

Parameters:
b - true if a timestamp should be logged with each message.

isLogTimestamp

public boolean isLogTimestamp()
Is a timestamp logged with each log message?

Returns:
true if a timestamp is logged with each message.

formatLine

public String formatLine(String reportIdentifier,
                         String severity,
                         String msg)
Description copied from interface: ReportLineFormatter
Format one log line.

Specified by:
formatLine in interface ReportLineFormatter
Parameters:
reportIdentifier - The identifier for the Report instance that wants the log line formatted. This may be null if the Report does not have an identifier set.
severity - A text representing the log message's severity, e.g. "INFO" or "TRACE".
msg - The log message.
Returns:
The formatted line.

formatStackTrace

public String formatStackTrace(String reportIdentifier,
                               String severity,
                               Throwable t)
Description copied from interface: ReportLineFormatter
Format a log message containing a stack trace. The message may span several lines.

Specified by:
formatStackTrace in interface ReportLineFormatter
Parameters:
reportIdentifier - The identifier for the Report instance that wants the log line formatted. This may be null if the Report does not have an identifier set.
severity - A text representing the log message's severity, e.g. "INFO" or "TRACE".
t - The Throwable containing the stack trace.
Returns:
The formatted message.