logahawk
Class SimpleLogger

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

@ThreadSafe
public class SimpleLogger
extends AbstractLogger

A simple implementation of Logger. This Logger blocks the caller when logging until the log request is completely handled. (This class does not use LogEntry.)


Field Summary
protected  ArgumentFormatterContainer argumentFormatterContainer
           
protected  ListenerContainer listenerContainer
           
protected  LogMetaProvider logMetaProvider
           
protected  SignatureFormatterContainer signatureFormatterContainer
           
 
Fields inherited from interface logahawk.Logger
LINE_SEPARATOR
 
Constructor Summary
SimpleLogger()
           
SimpleLogger(ArgumentFormatterContainer argumentFormatterContainer, SignatureFormatterContainer signatureFormatterContainer, ListenerContainer listenerContainer)
           
SimpleLogger(LogMetaProvider logMetaProvider)
           
SimpleLogger(LogMetaProvider logMetaProvider, ArgumentFormatterContainer argumentFormatterContainer, SignatureFormatterContainer signatureFormatterContainer, ListenerContainer listenerContainer)
           
 
Method Summary
protected  void broadcast(Severity severity, Object... data)
          This will broadcast the log message to all the Listener instances registered with this object.
protected  String format(List<Object> arguments)
          This will use the provided SignatureFormatters and ArgumentFormatters objects to format the provided arguments into a log-able string.
protected  String format(Object... data)
          This will use the installed "SignatureFormatter" and "ArgumentFormatter" objects to format the provided arguments into a log-able string.
 ArgumentFormatterContainer getArgumentFormatterContainer()
           
 ListenerContainer getListenerContainer()
           
 LogMetaProvider getLogMetaProvider()
           
 SignatureFormatterContainer getSignatureFormatterContainer()
           
 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

logMetaProvider

protected final LogMetaProvider logMetaProvider

argumentFormatterContainer

protected final ArgumentFormatterContainer argumentFormatterContainer

listenerContainer

protected final ListenerContainer listenerContainer

signatureFormatterContainer

protected final SignatureFormatterContainer signatureFormatterContainer
Constructor Detail

SimpleLogger

public SimpleLogger()

SimpleLogger

public SimpleLogger(LogMetaProvider logMetaProvider)

SimpleLogger

public SimpleLogger(ArgumentFormatterContainer argumentFormatterContainer,
                    SignatureFormatterContainer signatureFormatterContainer,
                    ListenerContainer listenerContainer)

SimpleLogger

public SimpleLogger(LogMetaProvider logMetaProvider,
                    ArgumentFormatterContainer argumentFormatterContainer,
                    SignatureFormatterContainer signatureFormatterContainer,
                    ListenerContainer listenerContainer)
Method Detail

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

getLogMetaProvider

public LogMetaProvider getLogMetaProvider()

getArgumentFormatterContainer

public ArgumentFormatterContainer getArgumentFormatterContainer()

getListenerContainer

public ListenerContainer getListenerContainer()

getSignatureFormatterContainer

public SignatureFormatterContainer getSignatureFormatterContainer()

broadcast

protected void broadcast(Severity severity,
                         Object... data)
This will broadcast the log message to all the Listener instances registered with this object. The epoch for the log messages will be set to the start of this method, and will be used for all calls to Listener.log().


format

protected String format(Object... data)
This will use the installed "SignatureFormatter" and "ArgumentFormatter" objects to format the provided arguments into a log-able string. This will call the static "format" method with the required data.


format

protected String format(List<Object> arguments)
This will use the provided SignatureFormatters and ArgumentFormatters objects to format the provided arguments into a log-able string. This will return null if there are no arguments provided. This will not catch any Exceptions encountered. If any of the formatters thrown an exception, this will fall back on a default formatting that is minimal but still useful.