package unify.fileio;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import unify.gui.GUIAlert;
public class MyLogger {
static private FileHandler fileTxt;
static private SimpleFormatter formatterTxt;
static public void setup(Level level) {
Logger logger = Logger.getLogger("unify");
logger.setLevel(level);
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh-mma");
Date currentTime_1 = new Date();
String dateTime = sdf.format(currentTime_1);
fileTxt = new FileHandler(dateTime + " log.txt");
} catch (SecurityException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
formatterTxt = new GUIAlert();
fileTxt.setFormatter(formatterTxt);
logger.addHandler(fileTxt);
}
}