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 java.lang.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 java.util.List<Redwood.Record> EMPTY
          An empty list to serve as the FALSE token for filters
 
Constructor Summary
LogRecordHandler()
           
 
Method Summary
abstract  java.util.List<Redwood.Record> handle(Redwood.Record record)
          Handle a log Record, either as a filter or by producing a side effect.
 java.util.List<Redwood.Record> signalEndTrack(int newDepth, long timeEnded)
          Signal the end of a track, i.e.
 java.util.List<Redwood.Record> signalShutdown()
           
 java.util.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 java.util.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 java.util.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 java.util.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 java.util.List<Redwood.Record> signalEndTrack(int newDepth,
                                                     long timeEnded)
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 java.util.List<Redwood.Record> signalShutdown()


Stanford NLP Group