actually fix stuff i guess

This commit is contained in:
ChomeNS 2023-03-29 07:56:21 +07:00
parent f41548c018
commit e1d8508cf1
2 changed files with 14 additions and 10 deletions

View file

@ -20,7 +20,6 @@ public class Logger {
public static LocalDate currentLogDate;
public static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("'['dd/MM/yyyy HH:mm:ss']' ");
public static final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("'dd/MM/yyyy'");
public static String prevEntry = "";
public static int duplicateCounter = 1;
@ -30,6 +29,7 @@ public class Logger {
public static long freezeTime = 0;
static {
try {
init();
executor.scheduleAtFixedRate(() -> {
try {
@ -38,6 +38,9 @@ public class Logger {
e.printStackTrace();
}
}, 0, 50, TimeUnit.MILLISECONDS);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void init() {
@ -72,7 +75,7 @@ public class Logger {
}
public static synchronized void makeNewLogFile() throws IOException {
currentLogDate = LocalDate.parse(LocalDate.now().format(dateFormatter));
currentLogDate = LocalDate.now();
logWriter = new OutputStreamWriter(new FileOutputStream(logFile, false), StandardCharsets.UTF_8);
logWriter.write(currentLogDate.toString() + '\n');
logWriter.flush();

View file

@ -22,6 +22,7 @@ public class LoggerPlugin extends ChatPlugin.ChatListener {
@Override
public void disconnected (DisconnectedEvent event) {
event.getCause().printStackTrace();
log("Disconnected from " + bot.host() + ":" + bot.port() + ", reason: " + event.getReason());
}
});