1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.logging;
17
18
19
20
21
22
23 public abstract class AbstractInternalLogger implements InternalLogger {
24
25
26
27
28 protected AbstractInternalLogger() {
29 }
30
31 public boolean isEnabled(InternalLogLevel level) {
32 switch (level) {
33 case DEBUG:
34 return isDebugEnabled();
35 case INFO:
36 return isInfoEnabled();
37 case WARN:
38 return isWarnEnabled();
39 case ERROR:
40 return isErrorEnabled();
41 default:
42 throw new Error();
43 }
44 }
45
46 public void log(InternalLogLevel level, String msg, Throwable cause) {
47 switch (level) {
48 case DEBUG:
49 debug(msg, cause);
50 break;
51 case INFO:
52 info(msg, cause);
53 break;
54 case WARN:
55 warn(msg, cause);
56 break;
57 case ERROR:
58 error(msg, cause);
59 break;
60 default:
61 throw new Error();
62 }
63 }
64
65 public void log(InternalLogLevel level, String msg) {
66 switch (level) {
67 case DEBUG:
68 debug(msg);
69 break;
70 case INFO:
71 info(msg);
72 break;
73 case WARN:
74 warn(msg);
75 break;
76 case ERROR:
77 error(msg);
78 break;
79 default:
80 throw new Error();
81 }
82 }
83 }