1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package ch.qos.logback.classic.util;
16
17 import ch.qos.logback.classic.Level;
18 import ch.qos.logback.core.joran.JoranConstants;
19 import ch.qos.logback.core.util.OptionHelper;
20
21 import static ch.qos.logback.core.joran.JoranConstants.NULL;
22
23
24
25
26
27
28
29 public class LevelUtil {
30
31
32 public static boolean isInheritedLevelString(String levelStr) {
33 if (JoranConstants.INHERITED.equalsIgnoreCase(levelStr) || NULL.equalsIgnoreCase(levelStr)) {
34 return true;
35 } else
36 return false;
37 }
38
39 public static Level levelStringToLevel(String levelStr) {
40 if (!OptionHelper.isNullOrEmptyOrAllSpaces(levelStr)) {
41 if (isInheritedLevelString(levelStr)) {
42 return null;
43 } else {
44 Level level = Level.toLevel(levelStr);
45 return level;
46 }
47 }
48 return null;
49 }
50
51 }