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
|
@Log4j2
|
||||||
public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, CommandSender {
|
public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, CommandSender {
|
||||||
private boolean colored = true;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isRunning() {
|
protected boolean isRunning() {
|
||||||
|
@ -55,41 +54,37 @@ public class GeyserStandaloneLogger extends SimpleTerminalConsole implements Gey
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void severe(String message) {
|
public void severe(String message) {
|
||||||
log.fatal(printConsole(ChatColor.DARK_RED + message, colored));
|
log.fatal(ChatColor.DARK_RED + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void severe(String message, Throwable error) {
|
public void severe(String message, Throwable error) {
|
||||||
log.fatal(printConsole(ChatColor.DARK_RED + message, colored), error);
|
log.fatal(ChatColor.DARK_RED + message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(String message) {
|
public void error(String message) {
|
||||||
log.error(printConsole(ChatColor.RED + message, colored));
|
log.error(ChatColor.RED + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(String message, Throwable error) {
|
public void error(String message, Throwable error) {
|
||||||
log.error(printConsole(ChatColor.RED + message, colored), error);
|
log.error(ChatColor.RED + message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void warning(String message) {
|
public void warning(String message) {
|
||||||
log.warn(printConsole(ChatColor.YELLOW + message, colored));
|
log.warn(ChatColor.YELLOW + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void info(String message) {
|
public void info(String message) {
|
||||||
log.info(printConsole(ChatColor.RESET + ChatColor.BOLD + message, colored));
|
log.info(ChatColor.RESET + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void debug(String message) {
|
public void debug(String message) {
|
||||||
log.debug(printConsole(ChatColor.GRAY + message, colored));
|
log.debug(ChatColor.GRAY + message);
|
||||||
}
|
|
||||||
|
|
||||||
public static String printConsole(String message, boolean colors) {
|
|
||||||
return colors ? ChatColor.toANSI(message + ChatColor.RESET) : ChatColor.stripColors(message + ChatColor.RESET);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"/>
|
<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>
|
</Console>
|
||||||
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
<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>
|
<Policies>
|
||||||
<TimeBasedTriggeringPolicy/>
|
<TimeBasedTriggeringPolicy/>
|
||||||
<OnStartupTriggeringPolicy/>
|
<OnStartupTriggeringPolicy/>
|
||||||
|
|
Loading…
Reference in a new issue