forked from ChomeNS/chomens-bot-java
actually fix stuff i guess
This commit is contained in:
parent
f41548c018
commit
e1d8508cf1
2 changed files with 14 additions and 10 deletions
|
@ -20,7 +20,6 @@ public class Logger {
|
||||||
|
|
||||||
public static LocalDate currentLogDate;
|
public static LocalDate currentLogDate;
|
||||||
public static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("'['dd/MM/yyyy HH:mm:ss']' ");
|
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 String prevEntry = "";
|
||||||
public static int duplicateCounter = 1;
|
public static int duplicateCounter = 1;
|
||||||
|
@ -30,14 +29,18 @@ public class Logger {
|
||||||
public static long freezeTime = 0;
|
public static long freezeTime = 0;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
init();
|
try {
|
||||||
executor.scheduleAtFixedRate(() -> {
|
init();
|
||||||
try {
|
executor.scheduleAtFixedRate(() -> {
|
||||||
tick();
|
try {
|
||||||
} catch (Exception e) {
|
tick();
|
||||||
e.printStackTrace();
|
} catch (Exception e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
}, 0, 50, TimeUnit.MILLISECONDS);
|
}
|
||||||
|
}, 0, 50, TimeUnit.MILLISECONDS);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
@ -72,7 +75,7 @@ public class Logger {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void makeNewLogFile() throws IOException {
|
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 = new OutputStreamWriter(new FileOutputStream(logFile, false), StandardCharsets.UTF_8);
|
||||||
logWriter.write(currentLogDate.toString() + '\n');
|
logWriter.write(currentLogDate.toString() + '\n');
|
||||||
logWriter.flush();
|
logWriter.flush();
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class LoggerPlugin extends ChatPlugin.ChatListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected (DisconnectedEvent event) {
|
public void disconnected (DisconnectedEvent event) {
|
||||||
|
event.getCause().printStackTrace();
|
||||||
log("Disconnected from " + bot.host() + ":" + bot.port() + ", reason: " + event.getReason());
|
log("Disconnected from " + bot.host() + ":" + bot.port() + ", reason: " + event.getReason());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue