Class AbstractLogger

java.lang.Object
org.xmlresolver.logging.AbstractLogger
All Implemented Interfaces:
ResolverLogger
Direct Known Subclasses:
DefaultLogger, SystemLogger

public abstract class AbstractLogger extends Object implements ResolverLogger
The abstract logger implements some of the core functionality needed regardless of how the messages are processed.
  • Field Details

  • Constructor Details

    • AbstractLogger

      public AbstractLogger()
      Initializes properties of the abstract class.
  • Method Details

    • getCategory

      public String getCategory(String cat)
      Returns the log level, "debug", "info", worn", or "none" associated with a category.
      Specified by:
      getCategory in interface ResolverLogger
      Parameters:
      cat - The category.
      Returns:
      The level. If no level has been configured for that category, the default is "debug".
    • setCategory

      public void setCategory(String cat, String level)
      Set the log level for a category. After this call, messages in the specified category will be logged at the specified level. Valid levels are "debug", "info", and "warn". An invalid level is treated as "debug".
      Specified by:
      setCategory in interface ResolverLogger
      Parameters:
      cat - The category.
      level - The level.
    • logMessage

      protected String logMessage(String cat, String message, Object... params)
    • log

      public void log(String cat, String message, Object... params)
      Log a message.

      The category is used to determine what level of logging is expected for this message. The message is then formatted with its parameters and logged.

      The message and its parameters are formatted with Formatter.

      Specified by:
      log in interface ResolverLogger
      Parameters:
      cat - The category.
      message - The message.
      params - The message parameters.