public interface Logger
Main interface for logging. Most operations are done through this interface.
This interface is heavily influenced by org.apache.logging.log4j2.Logger.
The most notable difference is lack of methods with Marker, LogBuilder and
the message supplier is
java.util.function.Supplier<String>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Logs a message at theDEBUG
level.void
Logs a message with parameters at theDEBUG
level.void
Logs a message at theDEBUG
level.void
Logs a lazily supplied String message.void
Logs a lazily supplied String message associated with a given throwable.void
Logs a message at theERROR
level.void
Logs a message with parameters at theERROR
level.void
Logs a message at theERROR
level.void
Logs a lazily supplied String message.void
Logs a lazily supplied String message associated with a given throwable.void
Logs a message at theFATAL
level.void
Logs a message with parameters at theFATAL
level.void
Logs a message at theFATAL
level.void
Logs a lazily supplied String message.void
Logs a lazily supplied String message associated with a given throwable.getName()
Gets the logger name.void
Logs a message at theINFO
level.void
Logs a message with parameters at theINFO
level.void
Logs a message at theINFO
level.void
Logs a lazily supplied String message.void
Logs a lazily supplied String message associated with a given throwable.boolean
Checks whether this Logger is enabled for theDEBUG
Level.boolean
Checks whether this Logger is enabled for the given Level.boolean
Checks whether this Logger is enabled for theERROR
Level.boolean
Checks whether this Logger is enabled for theFATAL
Level.boolean
Checks whether this Logger is enabled for theINFO
Level.boolean
Checks whether this Logger is enabled for theTRACE
Level.boolean
Checks whether this Logger is enabled for theWARN
Level.void
Logs a message String with the given level.void
Logs a lazily supplied String message associated with a given throwable.void
Logs a message at theTRACE
level.void
Logs a message with parameters at theTRACE
level.void
Logs a message at theTRACE
level.void
Logs a lazily supplied String message.void
Logs a lazily supplied String message associated with a given throwable.void
Logs a message at theWARN
level.void
Logs a message with parameters at theWARN
level.void
Logs a message at theWARN
level.void
Logs a lazily supplied String message.void
Logs a lazily supplied String message associated with a given throwable.
-
Method Details
-
log
Logs a message String with the given level.- Parameters:
level
- the logging levelmessage
- the message to log.
-
log
Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled for the specified log message level, then a message is logged that is the result produced by the given supplier function.- Parameters:
level
- the logging levelmessageSupplier
- A function, which when called, produces the desired log String message;throwable
- A Throwable associated with the log message.
-
getName
String getName()Gets the logger name.- Returns:
- the logger name.
-
isFatalEnabled
boolean isFatalEnabled()Checks whether this Logger is enabled for theFATAL
Level.- Returns:
- boolean -
true
if this Logger is enabled for levelFATAL
,false
otherwise.
-
isErrorEnabled
boolean isErrorEnabled()Checks whether this Logger is enabled for theERROR
Level.- Returns:
- boolean -
true
if this Logger is enabled for levelERROR
,false
otherwise.
-
isWarnEnabled
boolean isWarnEnabled()Checks whether this Logger is enabled for theWARN
Level.- Returns:
- boolean -
true
if this Logger is enabled for levelWARN
,false
otherwise.
-
isInfoEnabled
boolean isInfoEnabled()Checks whether this Logger is enabled for theINFO
Level.- Returns:
- boolean -
true
if this Logger is enabled for levelINFO
,false
otherwise.
-
isDebugEnabled
boolean isDebugEnabled()Checks whether this Logger is enabled for theDEBUG
Level.- Returns:
- boolean -
true
if this Logger is enabled for levelDEBUG
,false
otherwise.
-
isTraceEnabled
boolean isTraceEnabled()Checks whether this Logger is enabled for theTRACE
Level.- Returns:
- boolean -
true
if this Logger is enabled for levelTRACE
,false
otherwise.
-
isEnabled
Checks whether this Logger is enabled for the given Level.Note that passing in
OFF
always returnstrue
.- Parameters:
level
- the Level to check- Returns:
- boolean -
true
if this Logger is enabled for level,false
otherwise.
-
fatal
Logs a lazily supplied String message. If the logger is currently enabled forFATAL
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;
-
fatal
Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled forFATAL
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;throwable
- A Throwable associated with the log message.
-
fatal
Logs a message at theFATAL
level.- Parameters:
message
- the message string to be logged
-
fatal
Logs a message at theFATAL
level.- Parameters:
message
- the message string to be loggedthrowable
- A Throwable associated with the log message.
-
fatal
Logs a message with parameters at theFATAL
level.- Parameters:
message
- the message to logparams
- parameters to the message.
-
error
Logs a lazily supplied String message. If the logger is currently enabled forERROR
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;
-
error
Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled forERROR
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;throwable
- A Throwable associated with the log message.
-
error
Logs a message at theERROR
level.- Parameters:
message
- the message string to be logged
-
error
Logs a message at theERROR
level.- Parameters:
message
- the message string to be loggedthrowable
- A Throwable associated with the log message.
-
error
Logs a message with parameters at theERROR
level.- Parameters:
message
- the message to logparams
- parameters to the message.
-
warn
Logs a lazily supplied String message. If the logger is currently enabled forWARN
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;
-
warn
Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled forWARN
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;throwable
- A Throwable associated with the log message.
-
warn
Logs a message at theWARN
level.- Parameters:
message
- the message string to be logged
-
warn
Logs a message at theWARN
level.- Parameters:
message
- the message string to be loggedthrowable
- A Throwable associated with the log message.
-
warn
Logs a message with parameters at theWARN
level.- Parameters:
message
- the message to logparams
- parameters to the message.
-
info
Logs a lazily supplied String message. If the logger is currently enabled forINFO
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;
-
info
Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled forINFO
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;throwable
- A Throwable associated with the log message.
-
info
Logs a message at theINFO
level.- Parameters:
message
- the message string to be logged
-
info
Logs a message at theINFO
level.- Parameters:
message
- the message string to be loggedthrowable
- A Throwable associated with the log message.
-
info
Logs a message with parameters at theINFO
level.- Parameters:
message
- the message to logparams
- parameters to the message.
-
debug
Logs a lazily supplied String message. If the logger is currently enabled forDEBUG
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;
-
debug
Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled forDEBUG
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;throwable
- A Throwable associated with the log message.
-
debug
Logs a message at theDEBUG
level.- Parameters:
message
- the message string to be logged
-
debug
Logs a message at theDEBUG
level.- Parameters:
message
- the message string to be loggedthrowable
- A Throwable associated with the log message.
-
debug
Logs a message with parameters at theDEBUG
level.- Parameters:
message
- the message to logparams
- parameters to the message.
-
trace
Logs a lazily supplied String message. If the logger is currently enabled forFATAL
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;
-
trace
Logs a lazily supplied String message associated with a given throwable. If the logger is currently enabled forFATAL
level, then a message is logged that is the result produced by the given supplier function.- Parameters:
messageSupplier
- A function, which when called, produces the desired log String message;throwable
- A Throwable associated with the log message.
-
trace
Logs a message at theTRACE
level.- Parameters:
message
- the message string to be logged
-
trace
Logs a message at theTRACE
level.- Parameters:
message
- the message string to be loggedthrowable
- A Throwable associated with the log message.
-
trace
Logs a message with parameters at theTRACE
level.- Parameters:
message
- the message to logparams
- parameters to the message.
-