Skip to content

Commit

Permalink
fix: flush writer on client shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy committed Aug 25, 2024
1 parent fef44dd commit 6c8bdaa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/actionlogger/ActionLoggerPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ClientShutdown;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
Expand Down Expand Up @@ -56,4 +58,13 @@ protected void shutDown() throws IOException {

log.debug("Shut down Action Logger");
}

@Subscribe
protected void onClientShutdown(ClientShutdown event) {
try {
writer.close();
} catch (Exception e) {
log.warn("Failed to close writer", e);
}
}
}

0 comments on commit 6c8bdaa

Please sign in to comment.