public class HistoricalLog extends Object
Constructor and Description |
---|
HistoricalLog(int limit,
String idStringFormat,
Object... args)
Constructor.
|
HistoricalLog(String idStringFormat,
Object... args)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
buildHistory(StringBuilder sb,
boolean includeStackTrace)
Write the history of this object to the given
StringBuilder . |
void |
buildHistory(StringBuilder sb,
int indent,
boolean includeStackTrace)
Write the history of this object to the given
StringBuilder . |
void |
logHistory(org.slf4j.Logger logger)
Write the history of this object to the given
Logger . |
void |
recordEvent(String noteFormat,
Object... args)
Record an event.
|
public HistoricalLog(String idStringFormat, Object... args)
idStringFormat
- String.format(java.lang.String, java.lang.Object...)
format string that can be used
to identify this object in a log. Including some kind of unique identifier
that can be associated with the object instance is best.args
- for the format string, or nothing if none are requiredpublic HistoricalLog(int limit, String idStringFormat, Object... args)
This form supports the specification of a limit that will limit the number of historical entries kept (which keeps down the amount of memory used). With the limit, the first entry made is always kept (under the assumption that this is the creation site of the object, which is usually interesting), and then up to the limit number of entries are kept after that. Each time a new entry is made, the oldest that is not the first is dropped.
limit
- the maximum number of historical entries that will be kept,
not including the first entry madeidStringFormat
- String.format(java.lang.String, java.lang.Object...)
format string that can be used
to identify this object in a log. Including some kind of unique identifier
that can be associated with the object instance is best.args
- for the format string, or nothing if none are requiredpublic void recordEvent(String noteFormat, Object... args)
noteFormat
- String.format(java.lang.String, java.lang.Object...)
format string that describes the eventargs
- for the format string, or nothing if none are requiredpublic void buildHistory(StringBuilder sb, boolean includeStackTrace)
StringBuilder
. The history
includes the identifying string provided at construction time, and all the recorded
events with their stack traces.sb
- StringBuilder
to write toincludeStackTrace
- true if history includes stack trace, otherwise falsepublic void buildHistory(StringBuilder sb, int indent, boolean includeStackTrace)
StringBuilder
. The history
includes the identifying string provided at construction time, and all the recorded
events with their stack traces.sb
- StringBuilder
to write toindent
- size of indentincludeStackTrace
- true if history includes stack trace, otherwise falsepublic void logHistory(org.slf4j.Logger logger)
Logger
. The history
includes the identifying string provided at construction time, and all the recorded
events with their stack traces.logger
- Logger
to write toCopyright © 1970 The Apache Software Foundation. All rights reserved.