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
ALoggerFactory
implementation 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 Logger
createLogger(java.lang.String name)
Create a newLogger
protected java.lang.String
getDelegateLoggerClassName()
The class name of delegate Loggerint
getPriority()
Get the priorityprotected boolean
isAvailable()
CurrentLoggerFactory
is 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:LoggerFactory
The class name of delegate Logger- Specified by:
getDelegateLoggerClassName
in classLoggerFactory
- Returns:
- non-null
-
isAvailable
protected boolean isAvailable()
Description copied from class:LoggerFactory
CurrentLoggerFactory
is available or not- Overrides:
isAvailable
in classLoggerFactory
- Returns:
true
if available
-
createLogger
public Logger createLogger(java.lang.String name)
Description copied from class:LoggerFactory
Create a newLogger
- Specified by:
createLogger
in classLoggerFactory
- Parameters:
name
- the name ofLogger
- Returns:
- non-null
-
getPriority
public int getPriority()
Description copied from interface:Prioritized
Get the priority- Returns:
- the default is
minimum one
-
-