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 entries
|
Nested Class Summary |
static class |
BufferedListener.Entry
A pure-data class that holds all the parts of each formatted log message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
entries
protected final Queue<BufferedListener.Entry> entries
BufferedListener
public BufferedListener()
- Initializes the
entries field with a ConcurrentLinkedQueue, which ensure the
thread-safety of this class.
BufferedListener
public BufferedListener(Queue<BufferedListener.Entry> queue)
- Parameters:
queue - The Queue instance to be used for the entries field. Note that this Queue must
be thread-safe for this class to be thread-safe.
log
public void log(Severity severity,
Date epoch,
String text)
- Description copied from interface:
Listener
- Logs the provided statement.
Normally this method should not throw any exceptions. If expections are expected it is recommend to wrap this
Listener with a FailSafeListener.
- Specified by:
log in interface Listener
getEntries
public Queue<BufferedListener.Entry> getEntries()