public interface Logger
It provides methods for logging messages, exception stack traces and combinations of the two.
LogLevel
,
LogService
Modifier and Type | Method and Description |
---|---|
void |
addLogListener(LogListener listener)
Adds an item to the list of registered listeners.
|
void |
alwaysLog(int level,
Object msg,
Throwable t)
Logs a message with an exception.
|
default void |
debug(Object msg) |
default void |
debug(Object msg,
Throwable t) |
default void |
debug(Throwable t) |
default void |
error(Object msg) |
default void |
error(Object msg,
Throwable t) |
default void |
error(Throwable t) |
int |
getLevel()
Returns the log level of this logger.
|
default String |
getName()
Returns the name of this logger.
|
LogSource |
getSource()
Returns the
LogSource associated with this logger. |
default void |
info(Object msg) |
default void |
info(Object msg,
Throwable t) |
default void |
info(Throwable t) |
default boolean |
isDebug() |
default boolean |
isError() |
default boolean |
isInfo() |
default boolean |
isLevel(int level) |
default boolean |
isTrace() |
default boolean |
isWarn() |
default void |
log(int level,
Object msg)
Logs a message.
|
default void |
log(int level,
Object msg,
Throwable t)
Logs a message with an exception.
|
default void |
log(int level,
Throwable t)
Logs an exception.
|
void |
notifyListeners(LogMessage message)
Broadcasts the given log message to the registered listeners.
|
void |
removeLogListener(LogListener listener)
Removes an item from the list of registered listeners.
|
default Logger |
subLogger(String name)
Creates a sub logger, that forwards the message it gets to this logger.
|
Logger |
subLogger(String name,
int level)
Creates a sub logger, that forwards the message it gets to this logger.
|
default void |
trace(Object msg) |
default void |
trace(Object msg,
Throwable t) |
default void |
trace(Throwable t) |
default void |
warn(Object msg) |
default void |
warn(Object msg,
Throwable t) |
default void |
warn(Throwable t) |
default void debug(Object msg)
default void debug(Throwable t)
default void error(Object msg)
default void error(Throwable t)
default void info(Object msg)
default void info(Throwable t)
default void trace(Object msg)
default void trace(Throwable t)
default void warn(Object msg)
default void warn(Throwable t)
default boolean isDebug()
default boolean isError()
default boolean isInfo()
default boolean isTrace()
default boolean isWarn()
default boolean isLevel(int level)
default void log(int level, Object msg)
level
- The level at which the message will be logged. If the current
level (given by getLevel()
is below this one, no logging
is performed.msg
- The message to log.default void log(int level, Throwable t)
level
- The level at which the exception will be logged. If the
current level (given by getLevel()
is below this one, no
logging is performed.t
- The exception to log.default void log(int level, Object msg, Throwable t)
level
- The level at which the information will be logged. If the
current level (given by getLevel()
is below this one, no
logging is performed.msg
- The message to log.t
- The exception to log.void alwaysLog(int level, Object msg, Throwable t)
getLevel()
).level
- The level at which the information will be logged.msg
- The message to log.t
- The exception to log.default String getName()
int getLevel()
LogLevel
default Logger subLogger(String name)
Logger subLogger(String name, int level)
name
- The name of the sub logger.level
- The log level of the sub logger.void addLogListener(LogListener listener)
void removeLogListener(LogListener listener)
void notifyListeners(LogMessage message)
Copyright © 2015–2022 SciJava. All rights reserved.