package com.gyee.wisdom.dataadapter.help;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @descrition:全局变量或方法类
 * @author:WXW
 * @date:2020-05-06
 */
public class Constant
{
    public static SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//



    public static void d(String text)
    {
        System.out.println(text);
    }
    public static void dOneLine(String text)
    {
        System.out.print(text);
    }
    /*** @description: 日志文件打印 */
    public static void dd(String text)
    {
        SimpleDateFormat datef=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date=new Date();
        text=datef.format(date)+"\t"+text;
        System.out.println(text);
    }



    static String logPath=System.getProperty("userDataSet.dir")+"\\log\\";
    static String logName="log.txt";
    /*** @description: 日志文件写入 */
    public static void j( String message)
    {
        File testFile = new File(logPath);
        if(!testFile .exists())
        {
            testFile.mkdirs();
        }
        try
        {
            BufferedWriter writer = new BufferedWriter(new FileWriter(new File(logPath+logName),true));
            SimpleDateFormat datef=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
            Date date=new Date();
            message=datef.format(date)+"\t"+message;
            writer.write("\n"+message);
            writer.close();
            System.out.println(message);
        }
        catch(IOException e)
        {
            System.out.println(message);
        }

    }

}
