|
|||||||||
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 HashMap<String,Color> |
channelColors
|
protected char |
channelSeparatorChar
Character used to join multiple channel names |
protected HashMap<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 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 String |
tab
The tab character |
protected Color |
trackColor
The color to use for track beginning and ends |
protected 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(String channel,
Color color)
Color the tag for a particular channel this color |
List<Redwood.Record> |
handle(Redwood.Record record)
Handle a log Record, either as a filter or by producing a side effect. |
abstract void |
print(String line)
Print a string to an output without the trailing newline. |
void |
setColorChannels(boolean colorChannels)
|
List<Redwood.Record> |
signalEndTrack(int newDepth)
Signal the end of a track, i.e. |
List<Redwood.Record> |
signalStartTrack(Redwood.Record signal)
Signal the start of a track, i.e. |
protected StringBuilder |
style(StringBuilder b,
String line,
Color color,
Style style)
Style a particular String segment, according to a color and style |
void |
styleChannel(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 LinkedList<Redwood.Record> queuedTracks
protected Stack<edu.stanford.nlp.util.logging.OutputHandler.TrackInfo> trackStack
protected edu.stanford.nlp.util.logging.OutputHandler.TrackInfo info
protected String tab
protected char channelSeparatorChar
protected int leftMargin
protected int minLineCountForTrackNameReminder
protected Color trackColor
protected HashMap<String,Color> channelColors
protected boolean addRandomColors
protected Style trackStyle
protected HashMap<String,Style> channelStyles
Constructor Detail |
---|
public OutputHandler()
Method Detail |
---|
public abstract void print(String line)
line
- The string to be printed.public void colorChannel(String channel, Color color)
channel
- The channel to colorcolor
- The color to usepublic void styleChannel(String channel, Style style)
channel
- The channel to stylestyle
- The style to usepublic void setColorChannels(boolean colorChannels)
protected StringBuilder style(StringBuilder b, 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
public List<Redwood.Record> handle(Redwood.Record record)
handle
in class LogRecordHandler
record
- The log record to handle
public 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 List<Redwood.Record> signalEndTrack(int newDepth)
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 |