View Javadoc

    1   /*
    2    * Copyright 2012 The Netty Project
    3    *
    4    * The Netty Project licenses this file to you under the Apache License,
    5    * version 2.0 (the "License"); you may not use this file except in compliance
    6    * with the 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  class Slf4JLogger extends AbstractInternalLogger {
    24
    25      private final Logger logger;
    26
    27      Slf4JLogger(Logger logger) {
    28          this.logger = logger;
    29      }
    30
    31      public void debug(String msg) {
    32          logger.debug(msg);
    33      }
    34
    35      public void debug(String msg, Throwable cause) {
    36          logger.debug(msg, cause);
    37      }
    38
    39      public void error(String msg) {
    40          logger.error(msg);
    41      }
    42
    43      public void error(String msg, Throwable cause) {
    44          logger.error(msg, cause);
    45      }
    46
    47      public void info(String msg) {
    48          logger.info(msg);
    49      }
    50
    51      public void info(String msg, Throwable cause) {
    52          logger.info(msg, cause);
    53      }
    54
    55      public boolean isDebugEnabled() {
    56          return logger.isDebugEnabled();
    57      }
    58
    59      public boolean isErrorEnabled() {
    60          return logger.isErrorEnabled();
    61      }
    62
    63      public boolean isInfoEnabled() {
    64          return logger.isInfoEnabled();
    65      }
    66
    67      public boolean isWarnEnabled() {
    68          return logger.isWarnEnabled();
    69      }
    70
    71      public void warn(String msg) {
    72          logger.warn(msg);
    73      }
    74
    75      public void warn(String msg, Throwable cause) {
    76          logger.warn(msg, cause);
    77      }
    78
    79      @Override
    80      public String toString() {
    81          return String.valueOf(logger.getName());
    82      }
    83  }