Class Loggy


public class Loggy extends Loggable
This class extends Loggable and provides logging functionality through a logger object from the java.util.logging package.
Since:
Loggy 1.0
  • Field Details

    • logger

      protected final Logger logger
  • Constructor Details

    • Loggy

      public Loggy(String name, LoggyFormatter formatter)
      Constructs a Loggy object with a specified name and formatter.
      Parameters:
      name - the name of the logger
      formatter - the formatter used to format log messages
      Throws:
      IllegalArgumentException - if the logger name is null or empty
    • Loggy

      public Loggy(String name)
      Constructs a Loggy object with a specified name and a default formatter.
      Parameters:
      name - the name of the logger
  • Method Details

    • addLogsFiles

      protected void addLogsFiles(LoggyFile... files)
      Adds specified log files to the logger's handlers.
      Parameters:
      files - the log files to add
    • removeLogsFiles

      protected void removeLogsFiles(LoggyFile... files)
      Removes specified log files from the logger's handlers.
      Parameters:
      files - the log files to remove
    • buildStackTrace

      protected String buildStackTrace(Throwable thrown)
      Builds a stack trace from a Throwable object.
      Parameters:
      thrown - the Throwable object
      Returns:
      the stack trace
    • log

      public Loggy log(String message, Throwable thrown, LoggyLevel level, LoggyFile... files)
      Logs a message with a specified level and log files.
      Parameters:
      message - the message to log
      thrown - the Throwable object to log
      level - the level of the message
      files - the log files to log the message in
      Returns:
      the Loggy object
    • log

      public Loggy log(String message, LoggyLevel level, LoggyFile... files)
      Logs a message with a specified level and log files.
      Parameters:
      message - the message to log
      level - the level of the message
      files - the log files to log the message in
      Returns:
      the Loggy object
    • log

      public Loggy log(Throwable thrown, LoggyLevel level, LoggyFile... files)
      Logs a Throwable object with a specified level and log files.
      Parameters:
      thrown - the Throwable object to log
      level - the level of the message
      files - the log files to log the message in
      Returns:
      the Loggy object
    • getName

      public String getName()
      Returns the logger's name.
      Returns:
      the logger's name