Class Logger

java.lang.Object
dev.xdpxi.xdlib.api.Logger

public class Logger extends Object
A utility class for logging various log levels using Log4j. Provides methods for logging messages at different severity levels: debug, info, warn, and error.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static org.apache.logging.log4j.Logger
    The logger instance used for logging messages.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Logs a message at the DEBUG level.
    static void
    Logs a message at the ERROR level.
    static void
    info(String log)
    Logs a message at the INFO level.
    static void
    setup(String packageName, String modID)
    Sets up the logger for a specific package with a custom modID.
    static void
    warn(String log)
    Logs a message at the WARN level.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      public static org.apache.logging.log4j.Logger LOGGER
      The logger instance used for logging messages. This is initialized with an empty string as the logger name.
  • Constructor Details

    • Logger

      public Logger()
  • Method Details

    • setup

      public static void setup(String packageName, String modID)
      Sets up the logger for a specific package with a custom modID. This method should be called before any log messages are logged to initialize the logger for the package.
      Parameters:
      packageName - The name of the package.
      modID - The mod ID to be used as the logger name.
    • debug

      public static void debug(String log)
      Logs a message at the DEBUG level.
      Parameters:
      log - The message to be logged.
    • info

      public static void info(String log)
      Logs a message at the INFO level.
      Parameters:
      log - The message to be logged.
    • warn

      public static void warn(String log)
      Logs a message at the WARN level.
      Parameters:
      log - The message to be logged.
    • error

      public static void error(String log)
      Logs a message at the ERROR level.
      Parameters:
      log - The message to be logged.