Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AbstractLogger |
|
| 3.0;3 |
1 | package liquibase.logging.core; | |
2 | ||
3 | import liquibase.exception.UnexpectedLiquibaseException; | |
4 | import liquibase.logging.LogLevel; | |
5 | import liquibase.logging.Logger; | |
6 | ||
7 | 16 | public abstract class AbstractLogger implements Logger { |
8 | private LogLevel logLevel; | |
9 | ||
10 | public LogLevel getLogLevel() { | |
11 | 16795 | return logLevel; |
12 | } | |
13 | ||
14 | public void setLogLevel(String logLevel) { | |
15 | 17 | if ("debug".equalsIgnoreCase(logLevel)) { |
16 | 0 | setLogLevel(LogLevel.DEBUG); |
17 | 17 | } else if ("info".equalsIgnoreCase(logLevel)) { |
18 | 1 | setLogLevel(LogLevel.INFO); |
19 | 16 | } else if ("warning".equalsIgnoreCase(logLevel)) { |
20 | 0 | setLogLevel(LogLevel.WARNING); |
21 | 16 | } else if ("severe".equalsIgnoreCase(logLevel)) { |
22 | 16 | setLogLevel(LogLevel.SEVERE); |
23 | 0 | } else if ("off".equalsIgnoreCase(logLevel)) { |
24 | 0 | setLogLevel(LogLevel.OFF); |
25 | } else { | |
26 | 0 | throw new UnexpectedLiquibaseException("Unknown log level: " + logLevel |
27 | + ". Valid levels are: debug, info, warning, severe, off"); | |
28 | } | |
29 | 17 | } |
30 | ||
31 | public void setLogLevel(LogLevel level) { | |
32 | 17 | this.logLevel = level; |
33 | 17 | } |
34 | } |