org.jcoderz.commons.logging
Class LogPrinter

java.lang.Object
  extended by org.jcoderz.commons.logging.LogPrinter
Direct Known Subclasses:
BasicPrinter, XmlPrinter

public abstract class LogPrinter
extends Object

An instance of this formats and prints the output of the log viewer. Implementations of this differ in the format they use for printing the data.


Constructor Summary
LogPrinter()
           
 
Method Summary
protected  boolean displayStackTrace(LogItem entry)
          Gets information whether the stack trace of the supplied log file entry should be displayed.
 DisplayOptions getDisplayOptions()
          Gets the display options.
protected  LogItem getEntryForMoreStackTrace(LogItem entry, StackTraceInfo info)
          Get the LogItem needed to complete the stack trace when a '...nnn more' line has been encountered.
abstract  void print(PrintWriter printer, LogItem entry)
          Formats the log data and prints the formatted data using the supplied print writer.
 void setDisplayOptions(DisplayOptions options)
          Sets the options to use for formatting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogPrinter

public LogPrinter()
Method Detail

setDisplayOptions

public void setDisplayOptions(DisplayOptions options)
Sets the options to use for formatting.

Parameters:
options - The display options to set.
See Also:
DisplayOptions

getDisplayOptions

public final DisplayOptions getDisplayOptions()
Gets the display options.

Returns:
The configured display options.

print

public abstract void print(PrintWriter printer,
                           LogItem entry)
Formats the log data and prints the formatted data using the supplied print writer. A line feed is printed after the log data has been printed.

Parameters:
printer - The PrintWriter to use for printing the data.
entry - The log data to format and print using printer.

displayStackTrace

protected boolean displayStackTrace(LogItem entry)
Gets information whether the stack trace of the supplied log file entry should be displayed.

Parameters:
entry - The entry to check.
Returns:
true if the stack trace of entry should be displayed; false, else.

getEntryForMoreStackTrace

protected LogItem getEntryForMoreStackTrace(LogItem entry,
                                            StackTraceInfo info)
Get the LogItem needed to complete the stack trace when a '...nnn more' line has been encountered. This depends on the display settings, since we do not want to display the complete stacktrace again when it has been displayed already.

Parameters:
entry - The entry with the '...nnn more' stack trace line.
info - The '...nnn more' stack trace line.
Returns:
entry if the complete stack trace has already been displayed; the entry with the complete stacktrace, else.


Copyright 2007 The jCoderZ Project.