java.lang.Object
com.github.eventmanager.filehandlers.LogHandler

public class LogHandler extends Object
The LogHandler class is responsible for managing log files for the EventManager application. It handles log file creation, rotation based on size and time, and reading log file content.
Since:
1.0
  • Constructor Details

    • LogHandler

      public LogHandler(String configPath)
      Constructs a LogHandler with the specified ConfigLoader.
      Parameters:
      configPath - the path to the configuration file.
  • Method Details

    • checkIfLogFileNeedsRotation

      public void checkIfLogFileNeedsRotation()
      Checks if the log file needs rotation based on size and time.
    • rotateLogFile

      public void rotateLogFile(File file)
      Rotates the log file using the specified compression format.
      Parameters:
      file - the log file to rotate.
    • checkIfLogFileExists

      public boolean checkIfLogFileExists()
      Checks if the log file exists.
      Returns:
      true if the log file exists, false otherwise.
    • checkIfInternalLogFileExists

      public boolean checkIfInternalLogFileExists()
      Checks if the log file for internal events exists.
      Returns:
      true if the log file exists, false otherwise.
    • createLogFile

      public void createLogFile()
      Creates a new log file.
    • createInternalLogFile

      public void createInternalLogFile()
      Creates a new log file for internal events.
    • readLogFile

      public List<String> readLogFile()
      Reads the log file and returns its content as a list of strings.
      Returns:
      the content of the log file as a list of strings.