Class LogHandler
java.lang.Object
com.github.eventmanager.filehandlers.LogHandler
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 Summary
ConstructorsConstructorDescriptionLogHandler
(String configPath) Constructs a LogHandler with the specified ConfigLoader. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the log file for internal events exists.boolean
Checks if the log file exists.void
Checks if the log file needs rotation based on size and time.void
Creates a new log file for internal events.void
Creates a new log file.Reads the log file and returns its content as a list of strings.void
rotateLogFile
(File file) Rotates the log file using the specified compression format.
-
Constructor Details
-
LogHandler
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
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
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.
-