Skip to content

Commit

Permalink
Merge pull request #3485 from Articdive/master
Browse files Browse the repository at this point in the history
Fix logger toggling
  • Loading branch information
LlmDl authored Nov 2, 2019
2 parents fbacbe5 + 98edd36 commit 3194002
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
12 changes: 4 additions & 8 deletions src/com/palmergames/bukkit/towny/TownyLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,13 @@ public void enableDebugLogger() {
config.addLogger("com.palmergames.bukkit.towny.debug", townyDebugConfig);
}

public void disableDebugLogger() {
public void toggleDebugLogger() {
LoggerConfig townyDebugConfig = config.getLoggerConfig("Towny-Debug");
townyDebugConfig.removeAppender("Towny-Debug");
townyDebugConfig.removeAppender("File");
if (!Bukkit.getVersion().contains("Paper")) {
townyDebugConfig.removeAppender("TerminalConsole");
if (townyDebugConfig.isStarted()) {
townyDebugConfig.stop();
} else {
townyDebugConfig.removeAppender("Towny-Console-Paper");
townyDebugConfig.start();
}

config.removeLogger("com.palmergames.bukkit.towny.debug");
}

private void enableMoneyLogger() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1217,11 +1217,7 @@ public void parseToggleCommand(String[] split) throws TownyException {
try {
choice = !TownySettings.getDebug();
TownySettings.setDebug(choice);
if (choice) {
TownyLogger.getInstance().enableDebugLogger();
} else {
TownyLogger.getInstance().disableDebugLogger();
}
TownyLogger.getInstance().toggleDebugLogger();
TownyLogger.getInstance().updateLoggers();
TownyMessaging.sendMsg(getSender(), "Debug Mode " + (choice ? Colors.Green + TownySettings.getLangString("enabled") : Colors.Red + TownySettings.getLangString("disabled")));
} catch (Exception e) {
Expand Down

0 comments on commit 3194002

Please sign in to comment.