public interface LoggerSimple
As with other logging infrastructures, the name of the primitive used indicates the level of importance of the message.
All logging primitives (except the single-argument lr(Object)
) accept a message as argument, as well as a
number of Object
arguments that will be placed, in the order in which they were passed, in the placeholders
in the message. The placeholder string is specified by the constant ARGUMENT_PLACEHOLDER
(currently
"\\[\\]"). The result of call to the toString()
method of the argument is placed
between ARGUMENT_BEGIN
and ARGUMENT_END
.
The performance of an implementation is strongly influenced by when string concatenation is performed. The role of
the arguments
argument in the logging primitives is to delay string concatenation (components of the
message string and the various objects to place in it). Concatenation should only happen if the message is going to
be displayed. While the level of the message will be relayed to the wrapped logger (depending on wrapper), messages
should also be filtered in the class implementing this interface, such that the message string is only assembled if
necessary.
It works with a reduced set of levels: LoggerSimple.Level.TRACE
, LoggerSimple.Level.INFO
, LoggerSimple.Level.WARN
,
LoggerSimple.Level.ERROR
, plus LoggerSimple.Level.OFF
and LoggerSimple.Level.ALL
for log settings.
Modifier and Type | Interface and Description |
---|---|
static class |
LoggerSimple.Level
Indicates the level of the log.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARGUMENT_BEGIN
The string to be added before the rendition of the argument in the message string.
|
static java.lang.String |
ARGUMENT_END
The string to be added after the rendition of the argument in the message string.
|
static java.lang.String |
ARGUMENT_PLACEHOLDER
The substring in the message string that will be replaced with the various specified arguments.
|
Modifier and Type | Method and Description |
---|---|
void |
dbg(Debug.DebugItem debug,
java.lang.String message,
java.lang.Object... arguments)
Outputs a fine logging message only if the specified
Debug.DebugItem is activated. |
void |
le(java.lang.String message,
java.lang.Object... arguments)
Outputs an error message.
|
void |
lf(java.lang.String message,
java.lang.Object... arguments)
Outputs a 'fine' logging message.
|
void |
li(java.lang.String message,
java.lang.Object... arguments)
Outputs an info message.
|
java.lang.Object |
lr(java.lang.Object ret)
Outputs a fine logging message just before returning the
Object in the argument. |
java.lang.Object |
lr(java.lang.Object ret,
java.lang.String message,
java.lang.Object... arguments)
Outputs a fine logging message just before returning the
Object in the argument. |
void |
lw(java.lang.String message,
java.lang.Object... arguments)
Outputs a warning message.
|
static final java.lang.String ARGUMENT_PLACEHOLDER
static final java.lang.String ARGUMENT_BEGIN
static final java.lang.String ARGUMENT_END
void le(java.lang.String message, java.lang.Object... arguments)
message
- : the message string. Apparitions of the ARGUMENT_PLACEHOLDER
will be replaced with instances
in arguments
, in the order in which they appear, by calling their
Object.toString()
method.arguments
- : the arguments to be placed in the placeholders of the message string. Remaining arguments will be
added after the message.void lw(java.lang.String message, java.lang.Object... arguments)
message
- : the message string. Apparitions of the ARGUMENT_PLACEHOLDER
will be replaced with instances
in arguments
, in the order in which they appear, by calling their
Object.toString()
method.arguments
- : the arguments to be placed in the placeholders of the message string. Remaining arguments will be
added after the message.void li(java.lang.String message, java.lang.Object... arguments)
message
- : the message string. Apparitions of the ARGUMENT_PLACEHOLDER
will be replaced with instances
in arguments
, in the order in which they appear, by calling their
Object.toString()
method.arguments
- : the arguments to be placed in the placeholders of the message string. Remaining arguments will be
added after the message.void lf(java.lang.String message, java.lang.Object... arguments)
message
- : the message string. Apparitions of the ARGUMENT_PLACEHOLDER
will be replaced with instances
in arguments
, in the order in which they appear, by calling their
Object.toString()
method.arguments
- : the arguments to be placed in the placeholders of the message string. Remaining arguments will be
added after the message.java.lang.Object lr(java.lang.Object ret)
Object
in the argument.
This method is supposed to be used in return statements, e.g. return lr(value);
The message will contain the Object
in the argument.
ret
- : the Object
to return and to display.Object
passed as argument.java.lang.Object lr(java.lang.Object ret, java.lang.String message, java.lang.Object... arguments)
Object
in the argument.
This method is supposed to be used in return statements, e.g. return lr(value, message);
The Object
in the argument is also put in the log message, in a form decided by the implementation.
ret
- : the Object
to return and to display.message
- : the message to display beside the Object
. Apparitions of the ARGUMENT_PLACEHOLDER
will be replaced with instances in arguments
, in the order in which they appear, by
calling their Object.toString()
method.arguments
- : : the arguments to be placed in the placeholders of the message string. Remaining arguments will be
added after the message.Object
passed as argument.void dbg(Debug.DebugItem debug, java.lang.String message, java.lang.Object... arguments)
Debug.DebugItem
is activated.debug
- : the Debug.DebugItem
message
- : the message string. Apparitions of the ARGUMENT_PLACEHOLDER
will be replaced with instances
in arguments
, in the order in which they appear, by calling their
Object.toString()
method.arguments
- : the arguments to be placed in the placeholders of the message string. Remaining arguments will be
added after the message.