001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.transaction.util;
018
019 import org.apache.commons.logging.Log;
020 import org.apache.commons.logging.LogFactory;
021
022 /**
023 * @version $Id: CommonsLoggingLogger.java 493632 2007-01-07 01:57:31Z joerg $
024 * @since 1.3
025 */
026 public class CommonsLoggingLogger implements LoggerFacade {
027
028 private final Log log;
029
030 public CommonsLoggingLogger(final Log log) {
031 this.log = log;
032 }
033
034 public LoggerFacade createLogger(final String name) {
035 return new CommonsLoggingLogger(LogFactory.getLog(name));
036 }
037
038 public void logInfo(final String message) {
039 this.log.info(message);
040 }
041
042 public void logFine(final String message) {
043 this.log.debug(message);
044 }
045
046 public boolean isFineEnabled() {
047 return this.log.isDebugEnabled();
048 }
049
050 public void logFiner(final String message) {
051 this.log.debug(message);
052 }
053
054 public boolean isFinerEnabled() {
055 return this.log.isDebugEnabled();
056 }
057
058 public void logFinest(final String message) {
059 this.log.trace(message);
060 }
061
062 public boolean isFinestEnabled() {
063 return this.log.isTraceEnabled();
064 }
065
066 public void logWarning(final String message) {
067 this.log.warn(message);
068 }
069
070 public void logWarning(final String message, final Throwable t) {
071 this.log.warn(message, t);
072 }
073
074 public void logSevere(final String message) {
075 this.log.error(message);
076 }
077
078 public void logSevere(final String message, final Throwable t) {
079 this.log.error(message, t);
080 }
081
082 }