logahawk.listeners
Class BufferedListener

java.lang.Object
  extended by 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


Field Summary
protected  Queue<LogListenerEntry> listenerEntries
           
 
Constructor Summary
BufferedListener()
          Initializes the listenerEntries field with a ConcurrentLinkedQueue, which ensure the thread-safety of this class.
BufferedListener(Queue<LogListenerEntry> queue)
           
 
Method Summary
 Queue<LogListenerEntry> getEntries()
           
 void log(LogMeta meta, String text)
          Logs the provided statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerEntries

protected final Queue<LogListenerEntry> listenerEntries
Constructor Detail

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.
Method Detail

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()