1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.logging;
17
18 import java.util.logging.Level;
19 import java.util.logging.Logger;
20
21
22
23
24
25 class JdkLogger extends AbstractInternalLogger {
26
27 private final Logger logger;
28 private final String loggerName;
29
30 JdkLogger(Logger logger, String loggerName) {
31 this.logger = logger;
32 this.loggerName = loggerName;
33 }
34
35 public void debug(String msg) {
36 logger.logp(Level.FINE, loggerName, null, msg);
37 }
38
39 public void debug(String msg, Throwable cause) {
40 logger.logp(Level.FINE, loggerName, null, msg, cause);
41 }
42
43 public void error(String msg) {
44 logger.logp(Level.SEVERE, loggerName, null, msg);
45 }
46
47 public void error(String msg, Throwable cause) {
48 logger.logp(Level.SEVERE, loggerName, null, msg, cause);
49 }
50
51 public void info(String msg) {
52 logger.logp(Level.INFO, loggerName, null, msg);
53 }
54
55 public void info(String msg, Throwable cause) {
56 logger.logp(Level.INFO, loggerName, null, msg, cause);
57 }
58
59 public boolean isDebugEnabled() {
60 return logger.isLoggable(Level.FINE);
61 }
62
63 public boolean isErrorEnabled() {
64 return logger.isLoggable(Level.SEVERE);
65 }
66
67 public boolean isInfoEnabled() {
68 return logger.isLoggable(Level.INFO);
69 }
70
71 public boolean isWarnEnabled() {
72 return logger.isLoggable(Level.WARNING);
73 }
74
75 public void warn(String msg) {
76 logger.logp(Level.WARNING, loggerName, null, msg);
77 }
78
79 public void warn(String msg, Throwable cause) {
80 logger.logp(Level.WARNING, loggerName, null, msg, cause);
81 }
82
83 @Override
84 public String toString() {
85 return loggerName;
86 }
87 }