public interface Logger
Modifier and Type | Interface and Description |
---|---|
static interface |
Logger.ChoiceOfMessageSupplier
|
Modifier and Type | Method and Description |
---|---|
void |
debug(String msg)
Log a message at the DEBUG level.
|
void |
debug(String format,
Object... arguments)
Log a message at the DEBUG level according to the specified format
and arguments.
|
void |
debug(String msg,
Throwable t)
Log an exception (throwable) at the DEBUG level with an
accompanying message.
|
void |
error(String msg)
Log a message at the ERROR level.
|
void |
error(String format,
Object... arguments)
Log a message at the ERROR level according to the specified format
and arguments.
|
void |
error(String msg,
Throwable t)
Log an exception (throwable) at the ERROR level with an
accompanying message.
|
default void |
errorOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier)
Convenience method to log a message that is different according to the log level.
|
default void |
errorOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier,
Throwable cause)
Convenience method to log an exception (throwable), with an accompanying
message that is different according to the log level.
|
String |
getName()
Return the name of this
Logger instance. |
void |
info(String msg)
Log a message at the INFO level.
|
void |
info(String format,
Object... arguments)
Log a message at the INFO level according to the specified format
and arguments.
|
void |
info(String msg,
Throwable t)
Log an exception (throwable) at the INFO level with an
accompanying message.
|
default void |
infoOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier)
Convenience method to log a message that is different according to the log level.
|
default void |
infoOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier,
Throwable cause)
Convenience method to log an exception (throwable), with an accompanying
message that is different according to the log level.
|
boolean |
isDebugEnabled()
Is the logger instance enabled for the DEBUG level?
|
boolean |
isErrorEnabled()
Is the logger instance enabled for the ERROR level?
|
boolean |
isInfoEnabled()
Is the logger instance enabled for the INFO level?
|
boolean |
isTraceEnabled()
Is the logger instance enabled for the TRACE level?
|
boolean |
isWarnEnabled()
Is the logger instance enabled for the WARN level?
|
void |
trace(String msg)
Log a message at the TRACE level.
|
void |
trace(String format,
Object... arguments)
Log a message at the TRACE level according to the specified format
and arguments.
|
void |
trace(String msg,
Throwable t)
Log an exception (throwable) at the TRACE level with an
accompanying message.
|
void |
warn(String msg)
Log a message at the WARN level.
|
void |
warn(String format,
Object... arguments)
Log a message at the WARN level according to the specified format
and arguments.
|
void |
warn(String msg,
Throwable t)
Log an exception (throwable) at the WARN level with an
accompanying message.
|
default void |
warnOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier)
Convenience method to log a message that is different according to the log level.
|
default void |
warnOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier,
Throwable cause)
Convenience method to log an exception (throwable), with an accompanying
message that is different according to the log level.
|
String getName()
Logger
instance.boolean isTraceEnabled()
void trace(String msg)
msg
- the message string to be loggedvoid trace(String format, Object... arguments)
This form avoids superfluous string concatenation when the logger
is disabled for the TRACE level. However, this variant incurs the hidden
(and relatively small) cost of creating an Object[]
before invoking the method,
even if this logger is disabled for TRACE.
format
- the format stringarguments
- a list of 3 or more argumentsvoid trace(String msg, Throwable t)
msg
- the message accompanying the exceptiont
- the exception (throwable) to logboolean isDebugEnabled()
void debug(String msg)
msg
- the message string to be loggedvoid debug(String format, Object... arguments)
This form avoids superfluous string concatenation when the logger
is disabled for the DEBUG level. However, this variant incurs the hidden
(and relatively small) cost of creating an Object[]
before invoking the method,
even if this logger is disabled for DEBUG.
format
- the format stringarguments
- a list of 3 or more argumentsvoid debug(String msg, Throwable t)
msg
- the message accompanying the exceptiont
- the exception (throwable) to logboolean isInfoEnabled()
void info(String msg)
msg
- the message string to be loggedvoid info(String format, Object... arguments)
This form avoids superfluous string concatenation when the logger
is disabled for the INFO level. However, this variant incurs the hidden
(and relatively small) cost of creating an Object[]
before invoking the method,
even if this logger is disabled for INFO.
format
- the format stringarguments
- a list of 3 or more argumentsvoid info(String msg, Throwable t)
msg
- the message accompanying the exceptiont
- the exception (throwable) to logdefault void infoOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier)
isDebugEnabled()
.
Otherwise, INFO level is used (unless isInfoEnabled()
is false).
This can be used to log different level of details according to the active log level.
messageSupplier
- the Logger.ChoiceOfMessageSupplier
invoked in priority
with true
for the DEBUG level message, or false
for INFO levelinfo(String)
default void infoOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier, Throwable cause)
isDebugEnabled()
.
Otherwise, INFO level is used (unless isInfoEnabled()
is false).
This can be used to log different level of details according to the active log level.
messageSupplier
- the Logger.ChoiceOfMessageSupplier
invoked in priority
with true
for the DEBUG level message, or false
for INFO levelcause
- the Throwable
the original exception to be loggedinfo(String, Throwable)
boolean isWarnEnabled()
void warn(String msg)
msg
- the message string to be loggedvoid warn(String format, Object... arguments)
This form avoids superfluous string concatenation when the logger
is disabled for the WARN level. However, this variant incurs the hidden
(and relatively small) cost of creating an Object[]
before invoking the method,
even if this logger is disabled for WARN.
format
- the format stringarguments
- a list of 3 or more argumentsvoid warn(String msg, Throwable t)
msg
- the message accompanying the exceptiont
- the exception (throwable) to logdefault void warnOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier)
isDebugEnabled()
.
Otherwise, WARN level is used (unless isWarnEnabled()
is false).
This can be used to log different level of details according to the active log level.
messageSupplier
- the Logger.ChoiceOfMessageSupplier
invoked in priority
with true
for the DEBUG level message, or false
for WARN levelwarn(String)
default void warnOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier, Throwable cause)
isDebugEnabled()
.
Otherwise, WARN level is used (unless isWarnEnabled()
is false).
This can be used to log different level of details according to the active log level.
messageSupplier
- the Logger.ChoiceOfMessageSupplier
invoked in priority
with true
for the DEBUG level message, or false
for WARN levelcause
- the Throwable
the original exception to be loggedwarn(String, Throwable)
boolean isErrorEnabled()
void error(String msg)
msg
- the message string to be loggedvoid error(String format, Object... arguments)
This form avoids superfluous string concatenation when the logger
is disabled for the ERROR level. However, this variant incurs the hidden
(and relatively small) cost of creating an Object[]
before invoking the method,
even if this logger is disabled for ERROR.
format
- the format stringarguments
- a list of 3 or more argumentsvoid error(String msg, Throwable t)
msg
- the message accompanying the exceptiont
- the exception (throwable) to logdefault void errorOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier)
isDebugEnabled()
.
Otherwise, ERROR level is used (unless isErrorEnabled()
is false).
This can be used to log different level of details according to the active log level.
messageSupplier
- the Logger.ChoiceOfMessageSupplier
invoked in priority
with true
for the DEBUG level message, or false
for ERROR levelerror(String)
default void errorOrDebug(Logger.ChoiceOfMessageSupplier messageSupplier, Throwable cause)
isDebugEnabled()
.
Otherwise, ERROR level is used (unless isErrorEnabled()
is false).
This can be used to log different level of details according to the active log level.
messageSupplier
- the Logger.ChoiceOfMessageSupplier
invoked in priority
with true
for the DEBUG level message, or false
for ERROR levelcause
- the Throwable
the original exception to be loggederror(String, Throwable)