Package org.omegazero.common.logging
Interface Logger
- All Known Implementing Classes:
StandardLogger
public interface Logger
A class used for outputting application messages.
Messages may be written line by line with any log level defined in LogLevel
. More verbose messages should generally be written with a higher log level than more important messages.
For example, the "debug" log level should be used for log messages useful for basic debugging by an application developer or user with advanced knowledge of the application, while "error"
should be used for any messages that may require intervention by any user.
Generated log messages are written to any number of configured LoggerOutput
s.
- Since:
- 2.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic Logger
create()
Creates a new logger bound to the calling class.default boolean
debug()
Utility function to check if debugging is enabled.default void
Logs the given message atLogLevel.DEBUG
.default void
Logs the given message atLogLevel.ERROR
.default void
Logs the given message atLogLevel.FATAL
.getLabel()
Returns the label used to identify thisLogger
in log messages.default void
Logs the given message atLogLevel.INFO
.default boolean
Checks if thisLogger
prints log messages, taking into account the configured log level and other logger settings.void
Constructs a log message from the given objects and outputs it at the given log level.default void
Logs the given message atLogLevel.TRACE
.default void
Logs the given message atLogLevel.WARN
.
-
Method Details
-
log
Constructs a log message from the given objects and outputs it at the given log level.- Parameters:
level
- The log level to output this message atobj
- The objects to construct a log message from, usually strings
-
getLabel
String getLabel()Returns the label used to identify thisLogger
in log messages.- Returns:
- The label
- Since:
- 2.5
-
trace
Logs the given message atLogLevel.TRACE
.- Parameters:
obj
- The objects to construct a log message from, usually strings
-
debug
Logs the given message atLogLevel.DEBUG
.- Parameters:
obj
- The objects to construct a log message from, usually strings
-
info
Logs the given message atLogLevel.INFO
.- Parameters:
obj
- The objects to construct a log message from, usually strings
-
warn
Logs the given message atLogLevel.WARN
.- Parameters:
obj
- The objects to construct a log message from, usually strings
-
error
Logs the given message atLogLevel.ERROR
.- Parameters:
obj
- The objects to construct a log message from, usually strings
-
fatal
Logs the given message atLogLevel.FATAL
.- Parameters:
obj
- The objects to construct a log message from, usually strings
-
debug
default boolean debug()Utility function to check if debugging is enabled.- Returns:
true
if the current log level isLogLevel.DEBUG
or higher- Since:
- 2.3
-
isLogging
Checks if thisLogger
prints log messages, taking into account the configured log level and other logger settings.- Parameters:
level
- The log level to check- Returns:
true
if this logger prints log messages on the given log level- Since:
- 2.5
- See Also:
-
create
Creates a new logger bound to the calling class.This function is equivalent to
LoggerUtil.createLogger()
.- Returns:
- The new logger instance
- Since:
- 2.3
-