logahawk.listeners
Class AppendableListener

java.lang.Object
  extended by logahawk.listeners.AppendableListener
All Implemented Interfaces:
Listener
Direct Known Subclasses:
StringBuilderListener, WriterListener

@ThreadSafe
public class AppendableListener
extends Object
implements Listener

Allows logging to any Appendable destination object, such as Writer, StringBuffer, or StringBuilder. This class is thread-safe if the Appendable and MessageFormatter are thread-safe.


Field Summary
protected  Appendable appendable
           
protected  MessageFormatter formatter
           
 
Constructor Summary
AppendableListener(Appendable appendable)
           
AppendableListener(Appendable appendable, MessageFormatter formatter)
           
 
Method Summary
 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

appendable

protected final Appendable appendable

formatter

protected final MessageFormatter formatter
Constructor Detail

AppendableListener

public AppendableListener(Appendable appendable)

AppendableListener

public AppendableListener(Appendable appendable,
                          MessageFormatter formatter)
Method Detail

log

public void log(LogMeta meta,
                String text)
         throws RuntimeException
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
Throws:
RuntimeException - Any Exceptions caught during a log attempt will be re-thrown as the inner exception of a RuntimeException.