public abstract class OutputHandler extends LogRecordHandler
Modifier and Type | Field and Description |
---|---|
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
|
EMPTY
Constructor and Description |
---|
OutputHandler() |
Modifier and Type | Method and Description |
---|---|
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
|
protected boolean |
supportsAnsi()
Specify whether this output handler supports ansi output
|
signalShutdown
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
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 useprotected boolean supportsAnsi()
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 channelpublic java.util.List<Redwood.Record> handle(Redwood.Record record)
handle
in class LogRecordHandler
record
- The log record to handlepublic 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.