Package net.spy.memcached.compat.log
Class SLF4JLogger
- java.lang.Object
-
- net.spy.memcached.compat.log.AbstractLogger
-
- net.spy.memcached.compat.log.SLF4JLogger
-
- All Implemented Interfaces:
Logger
public class SLF4JLogger extends AbstractLogger
Logging Implementation using the SLF4J logging facade.Note that by design, the SLF4J facade does not ship with an actual implementation so that it can be chosen during runtime. If you fail to provide a logging implementation during runtime, no log messages will be logged. See the SLF4J Manual for more information on how to do this.
Since SLF4J does not support a FATAL log level, errors logged at that level get promoted down to ERROR, since this is the highest level available.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description SLF4JLogger(java.lang.String name)
Get an instance of the SLF4JLogger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isDebugEnabled()
True if debug is enabled for this logger.boolean
isInfoEnabled()
True if debug is enabled for this logger.boolean
isTraceEnabled()
Checks whether TRACE logging is enabled.void
log(Level level, java.lang.Object message, java.lang.Throwable e)
Wrapper around SLF4J logger facade.
-
-
-
Method Detail
-
isTraceEnabled
public boolean isTraceEnabled()
Description copied from interface:Logger
Checks whether TRACE logging is enabled. This may return true, even when the logger is configured to not put the resulting output anywhere. You can use this method to avoid potential expensive (debugging) code when there is no need for it since it will be dropped anyway:if (log.isTraceEnabled()) { ... expensive code here ... log.trace(result); }
- Returns:
- true if trace messages would be displayed.
-
isDebugEnabled
public boolean isDebugEnabled()
Description copied from class:AbstractLogger
True if debug is enabled for this logger. Default implementation always returns false- Specified by:
isDebugEnabled
in interfaceLogger
- Specified by:
isDebugEnabled
in classAbstractLogger
- Returns:
- true if debug messages would be displayed
-
isInfoEnabled
public boolean isInfoEnabled()
Description copied from class:AbstractLogger
True if debug is enabled for this logger. Default implementation always returns false- Specified by:
isInfoEnabled
in interfaceLogger
- Specified by:
isInfoEnabled
in classAbstractLogger
- Returns:
- true if info messages would be displayed
-
log
public void log(Level level, java.lang.Object message, java.lang.Throwable e)
Wrapper around SLF4J logger facade.- Specified by:
log
in interfaceLogger
- Specified by:
log
in classAbstractLogger
- Parameters:
level
- net.spy.compat.log.Level level.message
- object messagee
- optional throwable
-
-