logahawk.listeners
Class BufferedListener
java.lang.Object
logahawk.listeners.BufferedListener
- All Implemented Interfaces:
- Listener
@ThreadSafe
public class BufferedListener
- extends Object
- implements Listener
A Listener
implementation that buffers all log arguments (prior to any formatting). This class does not
flush its listenerEntries
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
listenerEntries
protected final Queue<LogListenerEntry> listenerEntries
BufferedListener
public BufferedListener()
- Initializes the
listenerEntries
field with a ConcurrentLinkedQueue
, which ensure
the thread-safety of this class.
BufferedListener
public BufferedListener(Queue<LogListenerEntry> queue)
- Parameters:
queue
- The Queue instance to be used for the listenerEntries
field. Note that this
Queue must be thread-safe for this class to be thread-safe.
log
public void log(LogMeta meta,
String text)
- Description copied from interface:
Listener
- Logs the provided statement.
Normally this method should not throw any exceptions. If exceptions are expected it is recommend to wrap this
Listener with a FailSafeListener.
- Specified by:
log
in interface Listener
getEntries
public Queue<LogListenerEntry> getEntries()