mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
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.
This commit is contained in:
parent
c6589136bf
commit
e73b7f5941
2 changed files with 8 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<PatternLayout pattern="[%d{HH:mm:ss} %style{%highlight{%level}{FATAL=red dark, ERROR=red, WARN=yellow bright, INFO=cyan bright, DEBUG=green, TRACE=white}}] %minecraftFormatting{%msg}%n"/>
|
||||
</Console>
|
||||
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
||||
<PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %level{length=1} - %msg%n"/>
|
||||
<PatternLayout pattern="[%d{HH:mm:ss.SSS} %t/%level] %minecraftFormatting{%msg}{strip}%n"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy/>
|
||||
<OnStartupTriggeringPolicy/>
|
||||
|
|
Loading…
Reference in a new issue