Class Log

java.lang.Object
com.petarmc.lib.log.Log

public class Log extends Object
Utility class for obtaining logger instances. Supports injecting a custom PLogger implementation or creating default PLog instances.
  • Field Details

    • injected

      private static PLogger injected
  • Constructor Details

    • Log

      public Log()
  • Method Details

    • inject

      public static void inject(PLogger logger)
      Injects a custom logger to be returned by all get(java.lang.Class<?>) calls.
      Parameters:
      logger - the logger to inject
    • get

      public static PLogger get(Class<?> clazz)
      Returns a logger instance for the specified class. If a logger has been injected via inject(com.petarmc.lib.log.PLogger), it returns the injected logger. Otherwise, it returns a new PLog named after the class.
      Parameters:
      clazz - the class for which the logger is requested
      Returns:
      a logger instance
    • get

      public static PLogger get(String name)
      Returns a logger instance with the specified name. If a logger has been injected via inject(com.petarmc.lib.log.PLogger), it returns the injected logger. Otherwise, it returns a new PLog with the given name.
      Parameters:
      name - the name of the logger
      Returns:
      a logger instance