View Javadoc

1   /*
2    * Copyright 2009 Red Hat, Inc.
3    *
4    * Red Hat licenses this file to you under the Apache License, version 2.0
5    * (the "License"); you may not use this file except in compliance with the
6    * License.  You may obtain a copy of the License at:
7    *
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package org.jboss.netty.logging;
17  
18  import org.slf4j.Logger;
19  
20  /**
21   * <a href="http://www.slf4j.org/">SLF4J</a> logger.
22   *
23   * @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
24   * @author <a href="http://gleamynode.net/">Trustin Lee</a>
25   *
26   * @version $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
27   *
28   */
29  class Slf4JLogger extends AbstractInternalLogger {
30  
31      private final Logger logger;
32  
33      Slf4JLogger(Logger logger) {
34          this.logger = logger;
35      }
36  
37      public void debug(String msg) {
38          logger.debug(msg);
39      }
40  
41      public void debug(String msg, Throwable cause) {
42          logger.debug(msg, cause);
43      }
44  
45      public void error(String msg) {
46          logger.error(msg);
47      }
48  
49      public void error(String msg, Throwable cause) {
50          logger.error(msg, cause);
51      }
52  
53      public void info(String msg) {
54          logger.info(msg);
55      }
56  
57      public void info(String msg, Throwable cause) {
58          logger.info(msg, cause);
59      }
60  
61      public boolean isDebugEnabled() {
62          return logger.isDebugEnabled();
63      }
64  
65      public boolean isErrorEnabled() {
66          return logger.isErrorEnabled();
67      }
68  
69      public boolean isInfoEnabled() {
70          return logger.isInfoEnabled();
71      }
72  
73      public boolean isWarnEnabled() {
74          return logger.isWarnEnabled();
75      }
76  
77      public void warn(String msg) {
78          logger.warn(msg);
79      }
80  
81      public void warn(String msg, Throwable cause) {
82          logger.warn(msg, cause);
83      }
84  
85      @Override
86      public String toString() {
87          return String.valueOf(logger.getName());
88      }
89  }