edu.stanford.nlp.util.logging
Class LogRecordHandler

java.lang.Object
  extended by edu.stanford.nlp.util.logging.LogRecordHandler
Direct Known Subclasses:
OutputHandler, RepeatedRecordHandler, VisibilityHandler

public abstract class LogRecordHandler
extends Object

A log message handler. This can take the role of a filter, which blocks future handlers from receiving the message, or as an entity that produces a side effect based on the message (e.g. printing it to console or a file). All log Records pass through an ordered list of Handler objects; all operations done on a log Record are done by some handler or another. When writing filters, you should see BooleanLogRecordHandler instead which allows for a simpler interface.

See Also:
BooleanLogRecordHandler

Field Summary
static List<Redwood.Record> EMPTY
          An empty list to serve as the FALSE token for filters
 
Constructor Summary
LogRecordHandler()
           
 
Method Summary
abstract  List<Redwood.Record> handle(Redwood.Record record)
          Handle a log Record, either as a filter or by producing a side effect.
 List<Redwood.Record> signalEndTrack(int newDepth)
          Signal the end of a track, i.e.
 List<Redwood.Record> signalShutdown()
           
 List<Redwood.Record> signalStartTrack(Redwood.Record signal)
          Signal the start of a track, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final List<Redwood.Record> EMPTY
An empty list to serve as the FALSE token for filters

Constructor Detail

LogRecordHandler

public LogRecordHandler()
Method Detail

handle

public abstract List<Redwood.Record> handle(Redwood.Record record)
Handle a log Record, either as a filter or by producing a side effect.

Parameters:
record - The log record to handle
Returns:
a (possibly empty) list of records to be sent on in the pipeline

signalStartTrack

public List<Redwood.Record> signalStartTrack(Redwood.Record signal)
Signal the start of a track, i.e. that we have descended a level deeper.

Parameters:
signal - A record corresponding to the information in the track header. The depth in this object is the old log depth.
Returns:
A list of records to pass down the pipeline, not including the startTrack() signal. The returned records are passed to handle(), not startTrack(), and are sent before the startTrack() signal.

signalEndTrack

public List<Redwood.Record> signalEndTrack(int newDepth)
Signal the end of a track, i.e. that we have popped up to a higher level.

Parameters:
newDepth - The new depth; that is, the current depth - 1.
Returns:
A list of records to pass down the pipeline. The returned records are passed to handle(), not endTrack(). and are sent before the startTrack() signal.

signalShutdown

public List<Redwood.Record> signalShutdown()


Stanford NLP Group