From e73b7f59410fea0ff981f52671943ef03f952bce Mon Sep 17 00:00:00 2001 From: Redned Date: Sat, 24 Jul 2021 12:52:28 -0500 Subject: [PATCH] Use Minecraft color codes in console/logs, clean up log output and fix #1606 TerminalConsoleAppender lets us use the legacy colors on their own, so don't do our own ANSI handling. --- .../standalone/GeyserStandaloneLogger.java | 19 +++++++------------ .../standalone/src/main/resources/log4j2.xml | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java index 64e5b5e86..5255dc16f 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java @@ -36,7 +36,6 @@ import org.geysermc.connector.common.ChatColor; @Log4j2 public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, CommandSender { - private boolean colored = true; @Override protected boolean isRunning() { @@ -55,41 +54,37 @@ public class GeyserStandaloneLogger extends SimpleTerminalConsole implements Gey @Override public void severe(String message) { - log.fatal(printConsole(ChatColor.DARK_RED + message, colored)); + log.fatal(ChatColor.DARK_RED + message); } @Override public void severe(String message, Throwable error) { - log.fatal(printConsole(ChatColor.DARK_RED + message, colored), error); + log.fatal(ChatColor.DARK_RED + message, error); } @Override public void error(String message) { - log.error(printConsole(ChatColor.RED + message, colored)); + log.error(ChatColor.RED + message); } @Override public void error(String message, Throwable error) { - log.error(printConsole(ChatColor.RED + message, colored), error); + log.error(ChatColor.RED + message, error); } @Override public void warning(String message) { - log.warn(printConsole(ChatColor.YELLOW + message, colored)); + log.warn(ChatColor.YELLOW + message); } @Override public void info(String message) { - log.info(printConsole(ChatColor.RESET + ChatColor.BOLD + message, colored)); + log.info(ChatColor.RESET + message); } @Override public void debug(String message) { - log.debug(printConsole(ChatColor.GRAY + message, colored)); - } - - public static String printConsole(String message, boolean colors) { - return colors ? ChatColor.toANSI(message + ChatColor.RESET) : ChatColor.stripColors(message + ChatColor.RESET); + log.debug(ChatColor.GRAY + message); } @Override diff --git a/bootstrap/standalone/src/main/resources/log4j2.xml b/bootstrap/standalone/src/main/resources/log4j2.xml index 238a27da5..cd101f306 100644 --- a/bootstrap/standalone/src/main/resources/log4j2.xml +++ b/bootstrap/standalone/src/main/resources/log4j2.xml @@ -8,7 +8,7 @@ - +