public abstract class LogListener extends Object implements AutoCloseable
LogListener class is the base class for an object that is called for every log event. It is intended to
be used only in unit tests.
Logger classes will check for the presence
of listeners and invoke them as required.| Constructor and Description |
|---|
LogListener()
Construct a
LogListener - add the listener to the list of listeners. |
| Modifier and Type | Method and Description |
|---|---|
static void |
add(LogListener listener)
Add a listener to the list.
|
void |
close()
Close the listener - remove it from the list.
|
static void |
invokeAll(long time,
net.pwall.log.Logger logger,
net.pwall.log.Level level,
Object message,
Throwable throwable)
Invoke all listeners.
|
static boolean |
present()
Test whether listeners are present.
|
abstract void |
receive(long time,
net.pwall.log.Logger logger,
net.pwall.log.Level level,
Object message,
Throwable throwable)
Receive a log event.
|
static void |
remove(LogListener listener)
Remove a listener from the list.
|
public LogListener()
LogListener - add the listener to the list of listeners.public void close()
close in interface AutoCloseablepublic abstract void receive(long time,
net.pwall.log.Logger logger,
net.pwall.log.Level level,
Object message,
Throwable throwable)
time - the time of the event in millisecondslogger - the logger objectlevel - the logging levelmessage - the messagethrowable - a Throwable, if providedpublic static void add(LogListener listener)
listener - the listenerpublic static void remove(LogListener listener)
listener - the listenerpublic static boolean present()
true if listeners are presentpublic static void invokeAll(long time,
net.pwall.log.Logger logger,
net.pwall.log.Level level,
Object message,
Throwable throwable)
present() has
returned true.time - the time of the log in millisecondslogger - the originating Loggerlevel - the levelmessage - the log messagethrowable - the Throwable, if presentCopyright © 2024. All rights reserved.