Package de.mnl.osgi.lf4osgi.core
Class LoggerCatalogue<T>
- java.lang.Object
-
- de.mnl.osgi.lf4osgi.core.LoggerCatalogue<T>
-
- Type Parameters:
T
- the logger group type
public class LoggerCatalogue<T> extends Object
A manager for groups of loggers associated with a bundle. A Logger group for a given bundle is automatically discarded when the associated bundle is uninstalled.
-
-
Constructor Summary
Constructors Constructor Description LoggerCatalogue(Function<Bundle,T> groupSupplier)
Instantiates a new logger catalogue.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Optional<Bundle>
findBundle(String providingClass)
Find the bundle that contains the class that wants to get a logger, using the current call stack.T
getLoggerGoup(Bundle bundle)
Returns the logger group for the given bundle.
-
-
-
Constructor Detail
-
LoggerCatalogue
public LoggerCatalogue(Function<Bundle,T> groupSupplier)
Instantiates a new logger catalogue.- Parameters:
groupSupplier
- the supplier for new logger groups
-
-
Method Detail
-
findBundle
public static Optional<Bundle> findBundle(String providingClass)
Find the bundle that contains the class that wants to get a logger, using the current call stack.The bundle is determined from the class that invoked
getLogger
, which—in turn—is searched for in the call stack as caller of thegetLogger
method of the class that provides the loggers from the users point of view.- Parameters:
providingClass
- the providing class- Returns:
- the bundle
-
getLoggerGoup
public T getLoggerGoup(Bundle bundle)
Returns the logger group for the given bundle.- Parameters:
bundle
- the bundle- Returns:
- the logger group
-
-