Package io.microsphere.logging
Class NoOpLoggerFactory
- java.lang.Object
-
- io.microsphere.logging.LoggerFactory
-
- io.microsphere.logging.NoOpLoggerFactory
-
- All Implemented Interfaces:
Prioritized,java.lang.Comparable<Prioritized>
public class NoOpLoggerFactory extends LoggerFactory
ALoggerFactoryimplementation that provides instances ofNoOpLogger, which perform no operations for logging calls. This factory is always available and has the lowest possible priority to ensure it is used only when no other logger implementations are available.Example Usage
// Get a NoOpLogger instance by class Logger logger = NoOpLoggerFactory.getLogger(MyClass.class); // Get a NoOpLogger instance by name Logger logger = NoOpLoggerFactory.getLogger("my.logger.name");- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
NoOpLogger,LoggerFactory
-
-
Field Summary
-
Fields inherited from interface io.microsphere.lang.Prioritized
COMPARATOR, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description NoOpLoggerFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoggercreateLogger(java.lang.String name)Create a newLoggerprotected java.lang.StringgetDelegateLoggerClassName()The class name of delegate LoggerintgetPriority()Get the priorityprotected booleanisAvailable()CurrentLoggerFactoryis available or not-
Methods inherited from class io.microsphere.logging.LoggerFactory
getLogger, getLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.microsphere.lang.Prioritized
compareTo
-
-
-
-
Method Detail
-
getDelegateLoggerClassName
protected java.lang.String getDelegateLoggerClassName()
Description copied from class:LoggerFactoryThe class name of delegate Logger- Specified by:
getDelegateLoggerClassNamein classLoggerFactory- Returns:
- non-null
-
isAvailable
protected boolean isAvailable()
Description copied from class:LoggerFactoryCurrentLoggerFactoryis available or not- Overrides:
isAvailablein classLoggerFactory- Returns:
trueif available
-
createLogger
public Logger createLogger(java.lang.String name)
Description copied from class:LoggerFactoryCreate a newLogger- Specified by:
createLoggerin classLoggerFactory- Parameters:
name- the name ofLogger- Returns:
- non-null
-
getPriority
public int getPriority()
Description copied from interface:PrioritizedGet the priority- Returns:
- the default is
minimum one
-
-