Class Debugger

java.lang.Object
me.deecaad.core.utils.Debugger

public class Debugger extends Object
This class outlines an easier to use version of a Logger. Debuggers have the advantage of only displaying specific messages based on which LogLevel is currently being used. This means that debug messages are only shown when the user wants to see debug messages, and errors are shown if users want errors to be shown.
See Also:
  • Field Details

    • msg

      public String msg
    • permission

      public String permission
    • updateTime

      public long updateTime
  • Constructor Details

    • Debugger

      public Debugger(Logger logger, int level)
    • Debugger

      public Debugger(Logger logger, int level, boolean isPrintTraces)
  • Method Details

    • getLogger

      public Logger getLogger()
      Returns the backing Logger that belongs to the plugin that instantiated this debugger.
      Returns:
      The non-null Logger
    • getLevel

      public int getLevel()
      Gets the current numeric logging level that was input by the user.
      Returns:
      The non-negative numeric logging level.
    • setLevel

      public void setLevel(int level)
      Sets the numeric logging that. This level should be set by the user.
      Parameters:
      level - The non-negative numeric logging level.
    • canLog

      public boolean canLog(LogLevel level)
      Returns true if the given LogLevel can be logged based on the currently set numeric logging level.
      Parameters:
      level - The non-null LogLevel to test.
      Returns:
      true if the level can be logged.
    • debug

      public void debug(String... msg)
      Shorthand for using log(LogLevel, String...) at debugging level.
      Parameters:
      msg - The non-null messages to log.
      See Also:
    • info

      public void info(String... msg)
      Shorthand for using log(LogLevel, String...) at information level.
      Parameters:
      msg - The non-null messages to log.
      See Also:
    • warn

      public void warn(String... msg)
      Shorthand for using log(LogLevel, String...) at warning level.
      Parameters:
      msg - The non-null messages to log.
      See Also:
    • error

      public void error(String... msg)
      Shorthand for using log(LogLevel, String...) at error level.
      Parameters:
      msg - The non-null messages to log.
      See Also:
    • log

      public void log(LogLevel level, List<String> messages)
    • log

      public void log(LogLevel level, String... msg)
      Logs the given messages to console at the given LogLevel.
      Parameters:
      level - The non-null level to log the messages.
      msg - The non-null messages to log.
    • log

      public void log(LogLevel level, Throwable error)
      Logs the given exception to console at the given LogLevel.
      Parameters:
      level - The non-null level to log the messages.
      error - The non-null exception to log.
    • log

      public void log(LogLevel level, String msg, Throwable error)
      Logs the given message and the given exception at the given LogLevel. If the exception does not have a message, the msg is used as the message. Otherwise, they are logged separately.
      Parameters:
      level - The non-null level to log the messages.
      msg - The message to log.
      error - The exception to log.
    • validate

      public void validate(boolean bool, String... messages)
      Logs the given messages as a LogLevel.ERROR if the given bool is false.
      Parameters:
      bool - The condition to check for. If this is true, the messages are not logged.
      messages - The messages to log as an error.
    • validate

      public void validate(LogLevel level, boolean bool, String... messages)
      Logs the given messages at the given LogLevel if the given bool is false.
      Parameters:
      level - The logging level to log the messages.
      bool - The condition to check for. If this is true, the messages are not logged.
      messages - The messages to log.
    • start

      @Deprecated public void start(org.bukkit.plugin.Plugin plugin)
      Deprecated.
      Starts the warning runnable which warns opped users if an error occurs in console.
      Parameters:
      plugin - The plugin to schedule the task.
    • start

      public void start(com.cjcrafter.foliascheduler.ServerImplementation impl)