uk.ac.starlink.ttools.taplint
Class Reporter

java.lang.Object
  extended by uk.ac.starlink.ttools.taplint.Reporter

public class Reporter
extends Object

Handles logging for validation messages. The design (a single-level hierarchy of reporting stages) is not particularly elegant or general, and may be revised at some point, but is serves the current purposes of the TapLint tool.

Author:
Mark Taylor

Constructor Summary
Reporter(PrintStream out, ReportType[] types, int maxRepeat, boolean debug, int maxChar)
          Constructor.
 
Method Summary
 void clear()
          Clears any memory of which messages have been reported.
 void end()
          Signals end of reporting.
 void endSection()
          Ends the current section.
 String getSectionCode()
          Returns the section code for the most recently-started section.
 void println(String line)
          Writes a single line of text, truncating as required.
 void report(ReportCode code, String message)
          Reports a message.
 void report(ReportCode code, String message, Throwable err)
          Reports a message with an associated throwable.
 void reportTotals()
          Prints the total number of each report type reported by this object.
 void start()
          Signals beginning of reporting.
 void startSection(String scode, String message)
          Begins a reporting section.
 void summariseUnreportedMessages(String scode)
          Writes to the output stream a summary of messages which were suppressed in a given stage because the maximum repeat count was exceeded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reporter

public Reporter(PrintStream out,
                ReportType[] types,
                int maxRepeat,
                boolean debug,
                int maxChar)
Constructor.

Parameters:
out - destination stream
types - message types to report; others are discarded
maxRepeat - maximum number of times any given message may be repeated; subsequent instances are suppressed
debug - true iff you want to see full stacktraces for exceptions etc
maxChar - maximum number of total characters per line of output
Method Detail

start

public void start()
Signals beginning of reporting.


end

public void end()
Signals end of reporting.


startSection

public void startSection(String scode,
                         String message)
Begins a reporting section.

Parameters:
scode - short fixed-length (3-char?) identifier for the section about to start
message - terse (one-line) free-text description of the stage

getSectionCode

public String getSectionCode()
Returns the section code for the most recently-started section.

Returns:
current section code

summariseUnreportedMessages

public void summariseUnreportedMessages(String scode)
Writes to the output stream a summary of messages which were suppressed in a given stage because the maximum repeat count was exceeded.

Parameters:
scode - section code to summarise

endSection

public void endSection()
Ends the current section.


report

public void report(ReportCode code,
                   String message)
Reports a message.

Parameters:
code - report code; messages with the same code should identify essentially the same condition
message - free-text message; it may be multi-line and/or longish, but may in practice be truncated on output

report

public void report(ReportCode code,
                   String message,
                   Throwable err)
Reports a message with an associated throwable.

Parameters:
code - report code; messages with the same code should identify essentially the same condition
message - free-text message; it may be multi-line and/or longish, but may in practice be truncated on output
err - throwable

clear

public void clear()
Clears any memory of which messages have been reported.


reportTotals

public void reportTotals()
Prints the total number of each report type reported by this object.


println

public void println(String line)
Writes a single line of text, truncating as required.

Parameters:
line - line to print


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.