Class LoggerConfig

java.lang.Object
dev.ua.theroer.magicutils.config.logger.LoggerConfig

@ConfigFile("{logger_dir}/logger.{ext}") @ConfigReloadable(sections={"chat","console","sub-loggers"}) @Comment("MagicUtils Logger Configuration") public class LoggerConfig extends Object
Configuration for the MagicUtils Logger system. This class manages all logging-related settings including plugin identification, debug options, message formatting for both chat and console, and sub-logger configurations. Constructor initializes default values for all logging components.
  • Constructor Details

    • LoggerConfig

      public LoggerConfig()
      Default constructor for LoggerConfig.
  • Method Details

    • getChatGradient

      public String[] getChatGradient()
      Gets the chat gradient colors array.
      Returns:
      array of gradient colors for chat, or null if auto-generation is enabled
    • getConsoleGradient

      public String[] getConsoleGradient()
      Gets the console gradient colors array.
      Returns:
      array of gradient colors for console, or null if auto-generation is enabled
    • getChatColors

      public String[] getChatColors(String type)
      Gets the chat colors for a specific message type.
      Parameters:
      type - the message type
      Returns:
      array of colors for the specified type, or null if auto-generation is enabled or type not found
    • getConsoleColors

      public String[] getConsoleColors(String type)
      Gets the console colors for a specific message type.
      Parameters:
      type - the message type
      Returns:
      array of colors for the specified type, or null if auto-generation is enabled or type not found
    • isSubLoggerEnabled

      public boolean isSubLoggerEnabled(String name)
      Checks if a sub-logger is enabled.
      Parameters:
      name - the sub-logger name
      Returns:
      true if the sub-logger is enabled or not configured (defaults to enabled)
    • addSubLogger

      public boolean addSubLogger(String name)
      Adds a new sub-logger to the configuration if it doesn't already exist.
      Parameters:
      name - the name of the sub-logger to add
      Returns:
      true if the sub-logger was added, false otherwise
    • getPrefix

      public PrefixSettings getPrefix()
      Prefix configuration for chat and console messages.
      Returns:
      defensive copy of the current prefix settings
    • setPrefix

      public void setPrefix(PrefixSettings prefix)
      Replaces prefix settings.
      Parameters:
      prefix - prefix configuration to clone; null uses defaults
    • getDefaults

      public DefaultSettings getDefaults()
      Default logger options.
      Returns:
      defensive copy of default settings
    • setDefaults

      public void setDefaults(DefaultSettings defaults)
      Sets default logger options.
      Parameters:
      defaults - default settings to copy; null uses defaults
    • getChat

      public ChatSettings getChat()
      Chat-specific configuration.
      Returns:
      copy of chat settings
    • setChat

      public void setChat(ChatSettings chat)
      Sets chat-specific configuration.
      Parameters:
      chat - chat settings to copy; null uses defaults
    • getConsole

      public ConsoleSettings getConsole()
      Console-specific configuration.
      Returns:
      copy of console settings
    • setConsole

      public void setConsole(ConsoleSettings console)
      Sets console-specific configuration.
      Parameters:
      console - console settings to copy; null uses defaults
    • getHelp

      public HelpSettings getHelp()
      Help command formatting settings.
      Returns:
      copy of help settings
    • setHelp

      public void setHelp(HelpSettings help)
      Sets help command formatting settings.
      Parameters:
      help - help settings to copy; null uses defaults
    • getSubLoggers

      public Map<String, SubLoggerConfig> getSubLoggers()
      Sub-logger configurations keyed by name.
      Returns:
      copy of registered sub-loggers
    • setSubLoggers

      public void setSubLoggers(Map<String, SubLoggerConfig> subLoggers)
      Replaces sub-logger configurations.
      Parameters:
      subLoggers - map of sub-loggers to copy; null clears the map
    • getChatPrefixMode

      public PrefixMode getChatPrefixMode()
      Gets the chat prefix mode.
      Returns:
      the prefix mode for chat messages
    • getConsolePrefixMode

      public PrefixMode getConsolePrefixMode()
      Gets the console prefix mode.
      Returns:
      the prefix mode for console messages
    • getDefaultTarget

      public LogTarget getDefaultTarget()
      Gets the default target.
      Returns:
      the default target for messages
    • getCustomPrefix

      public String getCustomPrefix()
      Gets the custom prefix text without allocating a defensive copy of the prefix section.
      Returns:
      custom prefix string, or empty string if unset
    • isConsoleUseGradient

      public boolean isConsoleUseGradient()
      Returns whether console messages should use gradient coloring.
      Returns:
      true if console gradient is enabled
    • isConsoleStripFormatting

      public boolean isConsoleStripFormatting()
      Returns whether console messages should have formatting stripped.
      Returns:
      true if console formatting is stripped
    • resolveColors

      public String[] resolveColors(LogLevel level, boolean console)
      Resolves colors for given log level, using either chat or console settings.
      Parameters:
      level - log level
      console - true for console palette, false for chat
      Returns:
      array of hex colors
    • defaultColors

      public static String[] defaultColors(LogLevel level)
      Provides fallback colors when no configuration is available.
      Parameters:
      level - log level to resolve
      Returns:
      gradient colors for the specified level