Package anlavn.file

Class Log

java.lang.Object
anlavn.file.Log

public class Log extends Object
The Log class supports to print to console and output log file.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Log()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final void
    add(String text)
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Log

      public Log()
  • Method Details

    • add

      public static final void add(String text)
      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

      public static final void setPattern(String pattern)
      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

      public static final String 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.