logahawk
Class BufferedLogger
java.lang.Object
logahawk.AbstractLogger
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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[])
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.
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