logahawk.listeners
Class AppendableListener
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
appendable
protected final Appendable appendable
formatter
protected final MessageFormatter formatter
AppendableListener
public AppendableListener(Appendable appendable)
AppendableListener
public AppendableListener(Appendable appendable,
MessageFormatter formatter)
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.