logahawk.formatters
Class ThreadMessageFormatter
java.lang.Object
logahawk.formatters.ThreadMessageFormatter
- All Implemented Interfaces:
- MessageFormatter
public class ThreadMessageFormatter
- extends Object
- implements MessageFormatter
Provides the log formatting of ThreadLogMeta
, very similar to StandardMessageFormatter
. The format is
"Date [ThreadID-ThreadName] Severity: Message"
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
addTrailingLineBreak
protected final boolean addTrailingLineBreak
dateFormat
protected DateFormat dateFormat
buffer
protected final StringBuilder buffer
- A single StringBuilder is used to avoid having to re-allocate a string each time.
ThreadMessageFormatter
public ThreadMessageFormatter()
- Sets
addTrailingLineBreak
to false, and dateFormat
to DateArgFormatter.STD_DATE_FORMAT
ThreadMessageFormatter
public ThreadMessageFormatter(DateFormat dateFormat,
boolean addTrailingLineBreak)
- Parameters:
dateFormat
- A clone of this DateFormat
will be created (because DateFormat
s are not
inherently thread safe.
format
public String format(LogMeta meta,
String message)
- Specified by:
format
in interface MessageFormatter
getAddTrailingLineBreak
public boolean getAddTrailingLineBreak()
- Returns true if the formatter will append a trailing line break. By default this is false.