1 package org.apache.archiva.common.utils;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
26 * Slf4JPlexusLogger - temporary logger to provide an Slf4j Logger to those components
27 * outside of the archiva codebase that require a plexus logger.
31 public class Slf4JPlexusLogger implements org.codehaus.plexus.logging.Logger {
34 public Slf4JPlexusLogger(Class<?> clazz) {
35 log = LoggerFactory.getLogger(clazz);
38 public Slf4JPlexusLogger(String name) {
39 log = LoggerFactory.getLogger(name);
42 public void debug(String message) {
46 public void debug(String message, Throwable throwable) {
47 log.debug(message, throwable);
50 public void error(String message) {
54 public void error(String message, Throwable throwable) {
55 log.error(message, throwable);
58 public void fatalError(String message) {
62 public void fatalError(String message, Throwable throwable) {
63 log.error(message, throwable);
66 public org.codehaus.plexus.logging.Logger getChildLogger(String name) {
67 return new Slf4JPlexusLogger(log.getName() + "." + name);
70 public String getName() {
74 public int getThreshold() {
75 if (log.isTraceEnabled()) {
76 return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
77 } else if (log.isDebugEnabled()) {
78 return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
79 } else if (log.isInfoEnabled()) {
80 return org.codehaus.plexus.logging.Logger.LEVEL_INFO;
81 } else if (log.isWarnEnabled()) {
82 return org.codehaus.plexus.logging.Logger.LEVEL_WARN;
83 } else if (log.isErrorEnabled()) {
84 return org.codehaus.plexus.logging.Logger.LEVEL_ERROR;
87 return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED;
90 public void info(String message) {
94 public void info(String message, Throwable throwable) {
95 log.info(message, throwable);
98 public boolean isDebugEnabled() {
99 return log.isDebugEnabled();
102 public boolean isErrorEnabled() {
103 return log.isErrorEnabled();
106 public boolean isFatalErrorEnabled() {
107 return log.isErrorEnabled();
110 public boolean isInfoEnabled() {
111 return log.isInfoEnabled();
114 public boolean isWarnEnabled() {
115 return log.isWarnEnabled();
118 public void setThreshold(int threshold) {
122 public void warn(String message) {
126 public void warn(String message, Throwable throwable) {
127 log.warn(message, throwable);