Class 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 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<BundlefindBundle​(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 the getLogger 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