Package org.scijava.log
Class DefaultLogger
- java.lang.Object
-
- org.scijava.log.DefaultLogger
-
- All Implemented Interfaces:
Logger,LogListener
public class DefaultLogger extends Object implements Logger, LogListener
Default implementation ofLogger.- Author:
- Matthias Arzt, Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description DefaultLogger(LogListener destination, LogSource source, int level)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLogListener(LogListener listener)Adds an item to the list of registered listeners.voidalwaysLog(int level, Object msg, Throwable t)Logs a message with an exception.intgetLevel()Returns the log level of this logger. seeLogLevelLogSourcegetSource()Returns theLogSourceassociated with this logger.voidmessageLogged(LogMessage message)This method is normally called from many threads in parallel.voidnotifyListeners(LogMessage message)Broadcasts the given log message to the registered listeners.voidremoveLogListener(LogListener listener)Removes an item from the list of registered listeners.LoggersubLogger(String name, int level)Creates a sub logger, that forwards the message it gets to this logger.
-
-
-
Constructor Detail
-
DefaultLogger
public DefaultLogger(LogListener destination, LogSource source, int level)
-
-
Method Detail
-
getSource
public LogSource getSource()
Description copied from interface:LoggerReturns theLogSourceassociated with this logger.
-
getLevel
public int getLevel()
Description copied from interface:LoggerReturns the log level of this logger. seeLogLevel
-
alwaysLog
public void alwaysLog(int level, Object msg, Throwable t)Description copied from interface:LoggerLogs a message with an exception. This message will always be logged even if its level is above the current level (given byLogger.getLevel()).
-
subLogger
public Logger subLogger(String name, int level)
Description copied from interface:LoggerCreates a sub logger, that forwards the message it gets to this logger.
-
addLogListener
public void addLogListener(LogListener listener)
Description copied from interface:LoggerAdds an item to the list of registered listeners.- Specified by:
addLogListenerin interfaceLogger
-
removeLogListener
public void removeLogListener(LogListener listener)
Description copied from interface:LoggerRemoves an item from the list of registered listeners.- Specified by:
removeLogListenerin interfaceLogger
-
notifyListeners
public void notifyListeners(LogMessage message)
Description copied from interface:LoggerBroadcasts the given log message to the registered listeners.- Specified by:
notifyListenersin interfaceLogger
-
messageLogged
public void messageLogged(LogMessage message)
Description copied from interface:LogListenerThis method is normally called from many threads in parallel. It must be implemented highly thread safe and must not use any kind of locks.- Specified by:
messageLoggedin interfaceLogListener
-
-