1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.classic.pattern.color;
15
16 import ch.qos.logback.classic.Level;
17 import ch.qos.logback.classic.spi.ILoggingEvent;
18 import static ch.qos.logback.core.pattern.color.ANSIConstants.*;
19 import ch.qos.logback.core.pattern.color.ForegroundCompositeConverterBase;
20
21
22
23
24
25
26 public class HighlightingCompositeConverter extends ForegroundCompositeConverterBase<ILoggingEvent> {
27
28 @Override
29 protected String getForegroundColorCode(ILoggingEvent event) {
30 Level level = event.getLevel();
31 switch (level.toInt()) {
32 case Level.ERROR_INT:
33 return BOLD + RED_FG;
34 case Level.WARN_INT:
35 return RED_FG;
36 case Level.INFO_INT:
37 return BLUE_FG;
38 default:
39 return DEFAULT_FG;
40 }
41
42 }
43 }