public class SelectiveFormatter extends Formatter
Constructor and Description |
---|
SelectiveFormatter(Predicate<? super LogRecord> predicate,
Formatter delegate1,
Formatter delegate2) |
Modifier and Type | Method and Description |
---|---|
String |
format(LogRecord logRecord)
Calls delegate1 if the predicate evaluates to
true for the logRecord,
otherwise delegate2. |
static Formatter |
loggerLevelGreaterThan(Level threshold,
Formatter delegate1,
Formatter delegate2)
|
static Formatter |
logRecordLevelGreaterThan(Level threshold,
Formatter delegate1,
Formatter delegate2)
|
formatMessage, getHead, getTail
public String format(@Nullable LogRecord logRecord)
true
for the logRecord,
otherwise delegate2.format
in class Formatter
SelectiveFormatter(Predicate, Formatter, Formatter)
public static final Formatter loggerLevelGreaterThan(Level threshold, Formatter delegate1, 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 Formatter logRecordLevelGreaterThan(Level threshold, Formatter delegate1, 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.
Copyright © 2018 Arno Unkrig. All rights reserved.