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.jboss.logging.Logger;
    19
    20  /**
    21   * <a href="http://anonsvn.jboss.org/repos/common/common-logging-spi/">JBoss Logging</a>
    22   * logger.
    23   */
    24  class JBossLogger extends AbstractInternalLogger {
    25
    26      private final Logger logger;
    27
    28      JBossLogger(Logger logger) {
    29          this.logger = logger;
    30      }
    31
    32      public void debug(String msg) {
    33          logger.debug(msg);
    34      }
    35
    36      public void debug(String msg, Throwable cause) {
    37          logger.debug(msg, cause);
    38      }
    39
    40      public void error(String msg) {
    41          logger.error(msg);
    42      }
    43
    44      public void error(String msg, Throwable cause) {
    45          logger.error(msg, cause);
    46      }
    47
    48      public void info(String msg) {
    49          logger.info(msg);
    50      }
    51
    52      public void info(String msg, Throwable cause) {
    53          logger.info(msg, cause);
    54      }
    55
    56      @SuppressWarnings("deprecation")
    57      public boolean isDebugEnabled() {
    58          return logger.isDebugEnabled();
    59      }
    60
    61      public boolean isErrorEnabled() {
    62          return true;
    63      }
    64
    65      @SuppressWarnings("deprecation")
    66      public boolean isInfoEnabled() {
    67          return logger.isInfoEnabled();
    68      }
    69
    70      public boolean isWarnEnabled() {
    71          return true;
    72      }
    73
    74      public void warn(String msg) {
    75          logger.warn(msg);
    76      }
    77
    78      public void warn(String msg, Throwable cause) {
    79          logger.warn(msg, cause);
    80      }
    81
    82      @Override
    83      public String toString() {
    84          return String.valueOf(logger.getName());
    85      }
    86  }