logahawk.listeners
Class StreamListener
java.lang.Object
logahawk.listeners.StreamListener
- All Implemented Interfaces:
- Listener
@ThreadSafe
public class StreamListener
- extends Object
- implements Listener
A Listener
that outputs log messages to the provided stream. This does not add a new-line or any other
characters to the messages that are logged.
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 |
formatter
protected final MessageFormatter formatter
out
protected final OutputStream out
StreamListener
public StreamListener(OutputStream out)
StreamListener
public StreamListener(OutputStream out,
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 Exception
s caught during a log attempt will be re-thrown as the inner
exception of a RuntimeException.