Module bukkit.slf4j

Class BukkitLoggerFactory

java.lang.Object
com.djaytan.bukkit.slf4j.api.BukkitLoggerFactory
All Implemented Interfaces:
org.slf4j.ILoggerFactory

public final class BukkitLoggerFactory extends Object implements org.slf4j.ILoggerFactory
This class is responsible for creating SLF4J loggers based on a provided JUL one. This is a specific scenario that we need to rely on when creating Bukkit plugins. That's due to the logging design being based on a single instance shared across the whole plugin (mainly for appending the plugin name while not displaying technical information such as the class full name).
  • Constructor Details

    • BukkitLoggerFactory

      @Internal public BukkitLoggerFactory()
  • Method Details

    • provideBukkitLogger

      public static void provideBukkitLogger(@NotNull Logger jdk14Logger)
      Provides the Bukkit logger to be returned by any subsequent call to LoggerFactory.getLogger(String).
      Parameters:
      jdk14Logger - The single JUL logger instance to be used each time the LoggerFactory.getLogger(String) method is called.
    • getLogger

      @Contract("null -> fail") public org.slf4j.Logger getLogger(@Nullable @Nullable String name)
      Specified by:
      getLogger in interface org.slf4j.ILoggerFactory