Package fr.diskmth.loggy
Class LoggyFile
java.lang.Object
fr.diskmth.loggy.Loggable
fr.diskmth.loggy.LoggyFile
LoggyFile is a class that extends the java.util.logging.Handler class and is used to handle logging messages to a file.
- Since:
- Loggy 1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new LoggyFile object with the specified path and the default formatter.LoggyFile(String path, LoggyFormatter formatter) Constructs a new LoggyFile object with the specified path and formatter. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears any empty log files in the log directory.close()Closes the file handler and clears any existing logs in the directory.getDir()Returns the directory containing the log file.Returns the file handler for this LoggyFile object.Returns the filename of the log file.getPath()Returns the path to the log file.init()Initializes the log file by creating the directory if it doesn't exist, setting up the file handler, and clearing any existing logs in the directory.Methods inherited from class fr.diskmth.loggy.Loggable
getFormatter, isMuted, setFormatter, toggleMute
-
Field Details
-
path
-
fileHandler
-
-
Constructor Details
-
LoggyFile
Constructs a new LoggyFile object with the specified path and formatter.- Parameters:
path- the path to the log fileformatter- the formatter to use for formatting log messages
-
LoggyFile
Constructs a new LoggyFile object with the specified path and the default formatter.- Parameters:
path- the path to the log file
-
-
Method Details
-
init
Initializes the log file by creating the directory if it doesn't exist, setting up the file handler, and clearing any existing logs in the directory.- Returns:
- this LoggyFile object
-
close
Closes the file handler and clears any existing logs in the directory.- Returns:
- this LoggyFile object
-
clearLogDir
public void clearLogDir()Clears any empty log files in the log directory. -
getPath
Returns the path to the log file.- Returns:
- the path to the log file
-
getFileHandler
Returns the file handler for this LoggyFile object.- Returns:
- the file handler for this LoggyFile object
-
getDir
Returns the directory containing the log file.- Returns:
- the directory containing the log file
-
getFileName
Returns the filename of the log file.- Returns:
- the filename of the log file
-