org.apache.commons.transaction.util.CommonsLoggingLogger.java Source code

Java tutorial

Introduction

Here is the source code for org.apache.commons.transaction.util.CommonsLoggingLogger.java

Source

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.transaction.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @version $Id: CommonsLoggingLogger.java 493632 2007-01-07 01:57:31Z joerg $
 * @since 1.3
 */
public class CommonsLoggingLogger implements LoggerFacade {

    private final Log log;

    public CommonsLoggingLogger(final Log log) {
        this.log = log;
    }

    public LoggerFacade createLogger(final String name) {
        return new CommonsLoggingLogger(LogFactory.getLog(name));
    }

    public void logInfo(final String message) {
        this.log.info(message);
    }

    public void logFine(final String message) {
        this.log.debug(message);
    }

    public boolean isFineEnabled() {
        return this.log.isDebugEnabled();
    }

    public void logFiner(final String message) {
        this.log.debug(message);
    }

    public boolean isFinerEnabled() {
        return this.log.isDebugEnabled();
    }

    public void logFinest(final String message) {
        this.log.trace(message);
    }

    public boolean isFinestEnabled() {
        return this.log.isTraceEnabled();
    }

    public void logWarning(final String message) {
        this.log.warn(message);
    }

    public void logWarning(final String message, final Throwable t) {
        this.log.warn(message, t);
    }

    public void logSevere(final String message) {
        this.log.error(message);
    }

    public void logSevere(final String message, final Throwable t) {
        this.log.error(message, t);
    }

}