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 TypeMethodDescriptionvoidLogs a message at theDEBUGlevel.voidLogs a message with parameters at theDEBUGlevel.voidLogs a message at theDEBUGlevel.voidLogs a lazily supplied String message.voidLogs a lazily supplied String message associated with a given throwable.voidLogs a message at theERRORlevel.voidLogs a message with parameters at theERRORlevel.voidLogs a message at theERRORlevel.voidLogs a lazily supplied String message.voidLogs a lazily supplied String message associated with a given throwable.voidLogs a message at theFATALlevel.voidLogs a message with parameters at theFATALlevel.voidLogs a message at theFATALlevel.voidLogs a lazily supplied String message.voidLogs a lazily supplied String message associated with a given throwable.getName()Gets the logger name.voidLogs a message at theINFOlevel.voidLogs a message with parameters at theINFOlevel.voidLogs a message at theINFOlevel.voidLogs a lazily supplied String message.voidLogs a lazily supplied String message associated with a given throwable.booleanChecks whether this Logger is enabled for theDEBUGLevel.booleanChecks whether this Logger is enabled for the given Level.booleanChecks whether this Logger is enabled for theERRORLevel.booleanChecks whether this Logger is enabled for theFATALLevel.booleanChecks whether this Logger is enabled for theINFOLevel.booleanChecks whether this Logger is enabled for theTRACELevel.booleanChecks whether this Logger is enabled for theWARNLevel.voidLogs a message String with the given level.voidLogs a lazily supplied String message associated with a given throwable.voidLogs a message at theTRACElevel.voidLogs a message with parameters at theTRACElevel.voidLogs a message at theTRACElevel.voidLogs a lazily supplied String message.voidLogs a lazily supplied String message associated with a given throwable.voidLogs a message at theWARNlevel.voidLogs a message with parameters at theWARNlevel.voidLogs a message at theWARNlevel.voidLogs a lazily supplied String message.voidLogs 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 theFATALLevel.- Returns:
- boolean -
trueif this Logger is enabled for levelFATAL,falseotherwise.
-
isErrorEnabled
boolean isErrorEnabled()Checks whether this Logger is enabled for theERRORLevel.- Returns:
- boolean -
trueif this Logger is enabled for levelERROR,falseotherwise.
-
isWarnEnabled
boolean isWarnEnabled()Checks whether this Logger is enabled for theWARNLevel.- Returns:
- boolean -
trueif this Logger is enabled for levelWARN,falseotherwise.
-
isInfoEnabled
boolean isInfoEnabled()Checks whether this Logger is enabled for theINFOLevel.- Returns:
- boolean -
trueif this Logger is enabled for levelINFO,falseotherwise.
-
isDebugEnabled
boolean isDebugEnabled()Checks whether this Logger is enabled for theDEBUGLevel.- Returns:
- boolean -
trueif this Logger is enabled for levelDEBUG,falseotherwise.
-
isTraceEnabled
boolean isTraceEnabled()Checks whether this Logger is enabled for theTRACELevel.- Returns:
- boolean -
trueif this Logger is enabled for levelTRACE,falseotherwise.
-
isEnabled
Checks whether this Logger is enabled for the given Level.Note that passing in
OFFalways returnstrue.- Parameters:
level- the Level to check- Returns:
- boolean -
trueif this Logger is enabled for level,falseotherwise.
-
fatal
Logs a lazily supplied String message. If the logger is currently enabled forFATALlevel, 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 forFATALlevel, 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 theFATALlevel.- Parameters:
message- the message string to be logged
-
fatal
Logs a message at theFATALlevel.- Parameters:
message- the message string to be loggedthrowable- A Throwable associated with the log message.
-
fatal
Logs a message with parameters at theFATALlevel.- Parameters:
message- the message to logparams- parameters to the message.
-
error
Logs a lazily supplied String message. If the logger is currently enabled forERRORlevel, 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 forERRORlevel, 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 theERRORlevel.- Parameters:
message- the message string to be logged
-
error
Logs a message at theERRORlevel.- Parameters:
message- the message string to be loggedthrowable- A Throwable associated with the log message.
-
error
Logs a message with parameters at theERRORlevel.- Parameters:
message- the message to logparams- parameters to the message.
-
warn
Logs a lazily supplied String message. If the logger is currently enabled forWARNlevel, 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 forWARNlevel, 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 theWARNlevel.- Parameters:
message- the message string to be logged
-
warn
Logs a message at theWARNlevel.- Parameters:
message- the message string to be loggedthrowable- A Throwable associated with the log message.
-
warn
Logs a message with parameters at theWARNlevel.- Parameters:
message- the message to logparams- parameters to the message.
-
info
Logs a lazily supplied String message. If the logger is currently enabled forINFOlevel, 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 forINFOlevel, 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 theINFOlevel.- Parameters:
message- the message string to be logged
-
info
Logs a message at theINFOlevel.- Parameters:
message- the message string to be loggedthrowable- A Throwable associated with the log message.
-
info
Logs a message with parameters at theINFOlevel.- Parameters:
message- the message to logparams- parameters to the message.
-
debug
Logs a lazily supplied String message. If the logger is currently enabled forDEBUGlevel, 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 forDEBUGlevel, 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 theDEBUGlevel.- Parameters:
message- the message string to be logged
-
debug
Logs a message at theDEBUGlevel.- Parameters:
message- the message string to be loggedthrowable- A Throwable associated with the log message.
-
debug
Logs a message with parameters at theDEBUGlevel.- Parameters:
message- the message to logparams- parameters to the message.
-
trace
Logs a lazily supplied String message. If the logger is currently enabled forFATALlevel, 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 forFATALlevel, 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 theTRACElevel.- Parameters:
message- the message string to be logged
-
trace
Logs a message at theTRACElevel.- Parameters:
message- the message string to be loggedthrowable- A Throwable associated with the log message.
-
trace
Logs a message with parameters at theTRACElevel.- Parameters:
message- the message to logparams- parameters to the message.
-