logahawk.listeners
Class JavaLoggerListener
java.lang.Object
logahawk.listeners.JavaLoggerListener
- All Implemented Interfaces:
- Listener
@ThreadSafe
public class JavaLoggerListener
- extends Object
- implements Listener
A Listener
that uses the Java Logging API to perform the actual logging.
This implementation immediately checks Logger.isLoggable(Level)
to circumvent doing any unnecessary logging
and formatting.
Method Summary |
protected Level |
convert(Severity severity)
Converts our "Severity" into a Java Logging API "Level" object. |
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 |
formatter
protected volatile MessageFormatter formatter
logger
protected volatile Logger logger
JavaLoggerListener
public JavaLoggerListener(Logger logger)
JavaLoggerListener
public JavaLoggerListener(String name)
JavaLoggerListener
public JavaLoggerListener(String name,
MessageFormatter formatter)
JavaLoggerListener
public JavaLoggerListener(Logger logger,
MessageFormatter formatter)
log
public void log(LogMeta meta,
String text)
- 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
convert
protected Level convert(Severity severity)
- Converts our "Severity" into a Java Logging API "Level" object. This will do the best job it can in providing a
correct mapping, but there may be a single "Level" may be used for multiple "Severity" objects.