forked from ChomeNS/chomens-bot-java
fix
This commit is contained in:
parent
4fe66333d1
commit
fec4f20420
2 changed files with 13 additions and 3 deletions
|
@ -46,8 +46,18 @@ public class LoggerPlugin extends ChatPlugin.Listener {
|
|||
|
||||
@Override
|
||||
public void disconnected (DisconnectedEvent event) {
|
||||
final String reason = ComponentUtilities.stringifyAnsi(event.getReason());
|
||||
log("Disconnected from " + bot.host + ":" + bot.port + ", reason: " + reason);
|
||||
final Component reason = event.getReason();
|
||||
|
||||
final String message = "Disconnected from " + bot.host + ":" + bot.port + ", reason: ";
|
||||
|
||||
final String string = ComponentUtilities.stringify(reason);
|
||||
|
||||
if (logToConsole) {
|
||||
final String ansi = ComponentUtilities.stringifyAnsi(reason);
|
||||
|
||||
log(message + ansi, false, true);
|
||||
}
|
||||
log(message + string, true, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class FileLoggerUtilities {
|
|||
|
||||
if (!Files.exists(logPath)) Files.createFile(logPath);
|
||||
|
||||
logWriter = Files.newBufferedWriter(logPath, StandardOpenOption.WRITE);
|
||||
logWriter = Files.newBufferedWriter(logPath, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
logWriter.write(currentLogDate.toString() + '\n');
|
||||
logWriter.flush();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue