Package anlavn.file
Class Log
java.lang.Object
anlavn.file.Log
The Log class supports to print to console and output log file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final void
Use this method to write a log, it also print them to console.static final void
Use this method if you want to close the log file properly.static final String
Use this method to get current Log File location.static final void
setPattern
(String pattern) Use this method to set file name pattern.
-
Constructor Details
-
Log
public Log()
-
-
Method Details
-
add
Use this method to write a log, it also print them to console. Automatically add new lines.- Parameters:
text
- a string text you want write to log.
-
setPattern
Use this method to set file name pattern. The default value is 'dd-MM-yyyy___HH꞉mm꞉ss'.
Run this method first.- Parameters:
pattern
- is your file name pattern you want. Follows the SimpleDateFormat patterns.
-
getFilePath
Use this method to get current Log File location.- Returns:
- a string of Log File location.
-
closeFile
public static final void closeFile()Use this method if you want to close the log file properly. It is not necessary to use.
-