logahawk
Class BufferedLogger

java.lang.Object
  extended by logahawk.AbstractLogger
      extended by logahawk.BufferedLogger
All Implemented Interfaces:
Logger

@ThreadSafe
public class BufferedLogger
extends AbstractLogger

A Logger implementation that buffers all log arguments (prior to any formatting). This class does not flush its listenerEntries


Field Summary
protected  Queue<List<Object>> entries
          The Queue used to hold log arguments.
 
Fields inherited from interface logahawk.Logger
LINE_SEPARATOR
 
Constructor Summary
BufferedLogger()
          Initializes the entries field with a ConcurrentLinkedQueue, which ensure the thread-safety of this class.
BufferedLogger(Queue<List<Object>> queue)
           
 
Method Summary
 Queue<List<Object>> getEntries()
           
 void log(Severity severity, Object... data)
          Logs message with a provide Severity.
 
Methods inherited from class logahawk.AbstractLogger
alert, debug, error, fatal, info, panic, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entries

protected final Queue<List<Object>> entries
The Queue used to hold log arguments. The Queue should be thread-safe, as this class does no additional synchronizing beyond what the Queue provides. The default constructor initializes this to a ConcurrentLinkedQueue which ensures thread-safety. Each entry the log arguments from a single call to one of the various log messages, which is converted to a List using Arrays.asList(Object[])

Constructor Detail

BufferedLogger

public BufferedLogger()
Initializes the entries field with a ConcurrentLinkedQueue, which ensure the thread-safety of this class.


BufferedLogger

public BufferedLogger(Queue<List<Object>> 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.
Method Detail

getEntries

public Queue<List<Object>> getEntries()

log

public void log(Severity severity,
                Object... data)
Description copied from interface: Logger
Logs message with a provide Severity. Useful for dynamically determined Severity messages.

Specified by:
log in interface Logger
Specified by:
log in class AbstractLogger