All Downloads are FREE. Search and download functionalities are using the official Maven repository.

z11.logging.Logger Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version

package z11.logging;

import z11.*;

/**
 *
 * @author vietduc
 */
public class Logger {
    private static String logFileName = "";
    private static final String logFolder = "logs";
    
    public static void print(String str){
        if (logFileName.equals("")){
            z11.F_ile.createFolder(logFolder);
            logFileName = logFolder + "/log_" + z11.D_ate.getDateString("yyyy-MM-dd_HH-mm-ss") + ".txt";
            
        }
        
        z11.F_ile.writeStringToFile(logFileName, "[" + z11.D_ate.getDateString("yyyy-MM-dd HH:mm:ss") + "] " + str, true);
        System.out.println(str);
        
    }
    
    public static void print(){
        print(System.lineSeparator());
    }
    
    public static void main(String [] args){
        Logger.print("123abcabcsdf");
        Logger.print("1");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy