public static interface LDLogAdapter.Channel
LDLogger instance.
Applications or libraries that generate log output do not need to interact directly with
LDLogAdapter.Channel; implementations of it are created by whatever LDLogAdapter is
being used.
The logger will send messages to this object, each with an LDLogLevel. If
output is known to be completely disabled for the specified level, the LDLogAdapter.Channel
method should return immediately and do no other processing. Otherwise, for simple
messages it should call toString() on the message parameter. It can always
assume that message and format parameters are non-null.
The format parameter must use the same format defined by SimpleFormat.
The reason that format/param values are passed straight through from
LDLogger to LDLogAdapter.Channel, instead of having LDLogger do the string
interpolation, is that a LDLogAdapter.Channel implementation that is delegating to another
logging framework may not be able to know for sure whether a given log level is enabled
(since filtering rules might be configured elsewhere in that framework); providing the
parameters separately lets the implementation class decide whether or not to incur the
overhead of string interpolation.
The reason that there are four overloads for log(com.launchdarkly.logging.LDLogLevel, java.lang.Object) is for efficiency, to avoid
allocating a params array in the common case of a message with fewer than three parameters.
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEnabled(LDLogLevel level)
Tests whether log output for a certain level is at least potentially visible.
|
void |
log(LDLogLevel level,
java.lang.Object message)
Logs a simple message with no parameters.
|
void |
log(LDLogLevel level,
java.lang.String format,
java.lang.Object... params)
Logs a message with any number of parameters.
|
void |
log(LDLogLevel level,
java.lang.String format,
java.lang.Object param)
Logs a message with a single parameter.
|
void |
log(LDLogLevel level,
java.lang.String format,
java.lang.Object param1,
java.lang.Object param2)
Logs a message with two parameters.
|
boolean isEnabled(LDLogLevel level)
This is the underlying implementation of LDLogger.isEnabled(LDLogLevel).
The method should return true if the specified level is enabled in the sense that it will
not be automatically discarded by this LDLogAdapter.Channel. It should only return false if
the LDLogAdapter.Channel will definitely discard that level.
level - a log levelvoid log(LDLogLevel level, java.lang.Object message)
level - the log levelmessage - the messagevoid log(LDLogLevel level, java.lang.String format, java.lang.Object param)
level - the log levelformat - the format stringparam - the parametervoid log(LDLogLevel level, java.lang.String format, java.lang.Object param1, java.lang.Object param2)
level - the log levelformat - the format stringparam1 - the first parameterparam2 - the second parametervoid log(LDLogLevel level, java.lang.String format, java.lang.Object... params)
level - the log levelformat - the format stringparams - the parameters