mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 04:29:22 +00:00
Remove coloring of log.info messages (#851)
This commit is contained in:
parent
bc71d28598
commit
b0b5fde742
2 changed files with 40 additions and 1 deletions
36
common/src/main/java/haveno/common/app/LogHighlighter.java
Normal file
36
common/src/main/java/haveno/common/app/LogHighlighter.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* Derived from https://logback.qos.ch/xref/ch/qos/logback/classic/pattern/color/HighlightingCompositeConverter.html */
|
||||
|
||||
package haveno.common.app;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import static ch.qos.logback.core.pattern.color.ANSIConstants.BOLD;
|
||||
import static ch.qos.logback.core.pattern.color.ANSIConstants.DEFAULT_FG;
|
||||
import static ch.qos.logback.core.pattern.color.ANSIConstants.RED_FG;
|
||||
import ch.qos.logback.core.pattern.color.ForegroundCompositeConverterBase;
|
||||
|
||||
/**
|
||||
* Highlights inner-text depending on the level, in bold red for events of level
|
||||
* ERROR, in red for WARN, in the default color for INFO, and in the default color for other
|
||||
* levels.
|
||||
*/
|
||||
|
||||
public class LogHighlighter extends ForegroundCompositeConverterBase<ILoggingEvent> {
|
||||
|
||||
@Override
|
||||
protected String getForegroundColorCode(ILoggingEvent event) {
|
||||
Level level = event.getLevel();
|
||||
switch (level.toInt()) {
|
||||
case Level.ERROR_INT:
|
||||
return BOLD + RED_FG;
|
||||
case Level.WARN_INT:
|
||||
return RED_FG;
|
||||
case Level.INFO_INT:
|
||||
return DEFAULT_FG;
|
||||
default:
|
||||
return DEFAULT_FG;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<conversionRule conversionWord="hl2" converterClass="haveno.common.app.LogHighlighter" />
|
||||
|
||||
<appender name="CONSOLE_APPENDER" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%highlight(%d{MMM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{30}: %msg %xEx%n)</pattern>
|
||||
<pattern>%hl2(%d{MMM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{30}: %msg %xEx%n)</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
|
Loading…
Reference in a new issue