public class SelectiveFormatter
extends java.util.logging.Formatter
Formatter calls one of two delegates, depending on the evaluation result of a LogRecord Predicate.| Constructor and Description |
|---|
SelectiveFormatter(Predicate<? super java.util.logging.LogRecord> predicate,
java.util.logging.Formatter delegate1,
java.util.logging.Formatter delegate2) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
format(java.util.logging.LogRecord logRecord)
Calls
delegate1 if the predicate evaluates to true for the logRecord,
otherwise delegate2. |
static java.util.logging.Formatter |
loggerLevelGreaterThan(java.util.logging.Level threshold,
java.util.logging.Formatter delegate1,
java.util.logging.Formatter delegate2)
Returns a
Formatter that for each LogRecord invokes delegate1 if the level of the
processing Logger is greater than threshold, and for all other the delegate2. |
static java.util.logging.Formatter |
logRecordLevelGreaterThan(java.util.logging.Level threshold,
java.util.logging.Formatter delegate1,
java.util.logging.Formatter delegate2)
Returns a
Formatter that for each LogRecord invokes delegate1 if the level of the log
record is greater than ("more severe than") threshold, and for all other the delegate2. |
public SelectiveFormatter(Predicate<? super java.util.logging.LogRecord> predicate, java.util.logging.Formatter delegate1, java.util.logging.Formatter delegate2)
delegate1 - Is called for LogRecord for which the predicate evaluates to truedelegate2 - Is called for LogRecord for which the predicate evaluates to falsepublic java.lang.String format(java.util.logging.LogRecord logRecord)
delegate1 if the predicate evaluates to true for the logRecord,
otherwise delegate2.format in class java.util.logging.FormatterSelectiveFormatter(Predicate, Formatter, Formatter)public static final java.util.logging.Formatter loggerLevelGreaterThan(java.util.logging.Level threshold,
java.util.logging.Formatter delegate1,
java.util.logging.Formatter delegate2)
Formatter that for each LogRecord invokes delegate1 if the level of the
processing Logger is greater than threshold, and for all other the delegate2.
A typical application is to format log records WITHOUT stack traces, except if the logger's level is set to
Level.FINE or lower.
public static final java.util.logging.Formatter logRecordLevelGreaterThan(java.util.logging.Level threshold,
java.util.logging.Formatter delegate1,
java.util.logging.Formatter delegate2)
Formatter that for each LogRecord invokes delegate1 if the level of the log
record is greater than ("more severe than") threshold, and for all other the delegate2.
A typical application is to format log records WITHOUT stack traces, except if the logger's level is set to
Level.FINE or lower.