|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.logging.LogRecordHandler
edu.stanford.nlp.util.logging.OutputHandler
public abstract class OutputHandler
An abstract handler incorporating the logic of outputing a log message, to some source. This class is responsible for printing channel information, formatting tracks, and writing the actual log messages. Classes overriding this class should implement the print() method based on their output source.
Field Summary | |
---|---|
protected boolean |
addRandomColors
|
protected java.util.Map<java.lang.String,Color> |
channelColors
|
protected char |
channelSeparatorChar
Character used to join multiple channel names |
protected java.util.Map<java.lang.String,Style> |
channelStyles
|
protected edu.stanford.nlp.util.logging.OutputHandler.TrackInfo |
info
The current track info; used to avoid trackStack.peek() calls |
protected int |
leftMargin
The length of the left margin in which to print channel information. |
protected int |
minLineCountForTrackNameReminder
Number of lines above which the closing brace of a track shows the name of the track |
protected java.util.LinkedList<Redwood.Record> |
queuedTracks
A list of tracks which have been started but not yet printed as no log messages are in them yet. |
protected java.lang.String |
tab
The tab character |
protected Color |
trackColor
The color to use for track beginning and ends |
protected java.util.Stack<edu.stanford.nlp.util.logging.OutputHandler.TrackInfo> |
trackStack
Information about the current and higher level tracks |
protected Style |
trackStyle
The style to use for track beginning and ends |
Fields inherited from class edu.stanford.nlp.util.logging.LogRecordHandler |
---|
EMPTY |
Constructor Summary | |
---|---|
OutputHandler()
|
Method Summary | |
---|---|
void |
colorChannel(java.lang.String channel,
Color color)
Color the tag for a particular channel this color |
protected boolean |
formatChannel(java.lang.StringBuilder b,
java.lang.String channelStr,
java.lang.Object channel)
Format a channel |
java.util.List<Redwood.Record> |
handle(Redwood.Record record)
Handle a log Record, either as a filter or by producing a side effect. |
abstract void |
print(java.lang.Object[] channel,
java.lang.String line)
Print a string to an output without the trailing newline. |
void |
setColorChannels(boolean colorChannels)
|
java.util.List<Redwood.Record> |
signalEndTrack(int newDepth,
long timeOfEnd)
Signal the end of a track, i.e. |
java.util.List<Redwood.Record> |
signalStartTrack(Redwood.Record signal)
Signal the start of a track, i.e. |
protected java.lang.StringBuilder |
style(java.lang.StringBuilder b,
java.lang.String line,
Color color,
Style style)
Style a particular String segment, according to a color and style |
void |
styleChannel(java.lang.String channel,
Style style)
Style the tag for a particular channel this style |
Methods inherited from class edu.stanford.nlp.util.logging.LogRecordHandler |
---|
signalShutdown |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.LinkedList<Redwood.Record> queuedTracks
protected java.util.Stack<edu.stanford.nlp.util.logging.OutputHandler.TrackInfo> trackStack
protected edu.stanford.nlp.util.logging.OutputHandler.TrackInfo info
protected java.lang.String tab
protected char channelSeparatorChar
protected int leftMargin
protected int minLineCountForTrackNameReminder
protected Color trackColor
protected java.util.Map<java.lang.String,Color> channelColors
protected boolean addRandomColors
protected Style trackStyle
protected java.util.Map<java.lang.String,Style> channelStyles
Constructor Detail |
---|
public OutputHandler()
Method Detail |
---|
public abstract void print(java.lang.Object[] channel, java.lang.String line)
channel
- The channels this message was printed on; in most cases
an implementing handler should not have to do anything with
this. The channels should not be printed here.
The channels may be null.line
- The string to be printed.public void colorChannel(java.lang.String channel, Color color)
channel
- The channel to colorcolor
- The color to usepublic void styleChannel(java.lang.String channel, Style style)
channel
- The channel to stylestyle
- The style to usepublic void setColorChannels(boolean colorChannels)
protected java.lang.StringBuilder style(java.lang.StringBuilder b, java.lang.String line, Color color, Style style)
b
- The string builder to append to (for efficiency)line
- The String to be wrappedcolor
- The color to color asstyle
- The style to use
protected boolean formatChannel(java.lang.StringBuilder b, java.lang.String channelStr, java.lang.Object channel)
b
- The StringBuilder to append tochannelStr
- The [possibly truncated and/or modified] string
to actually print to the StringBuilderchannel
- The original channel
public java.util.List<Redwood.Record> handle(Redwood.Record record)
handle
in class LogRecordHandler
record
- The log record to handle
public java.util.List<Redwood.Record> signalStartTrack(Redwood.Record signal)
signalStartTrack
in class LogRecordHandler
signal
- A record corresponding to the information in the track header.
The depth in this object is the old log depth.
public java.util.List<Redwood.Record> signalEndTrack(int newDepth, long timeOfEnd)
signalEndTrack
in class LogRecordHandler
newDepth
- The new depth; that is, the current depth - 1.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |