001 package org.apache.maven.cli.logging;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements. See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership. The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License. You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied. See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022 import org.codehaus.plexus.logging.Logger;
023
024 /**
025 * Adapt an SLF4J logger to a Plexus logger, ignoring Plexus logger API parts that are not classical and
026 * probably not really used.
027 *
028 * @author Jason van Zyl
029 */
030 public class Slf4jLogger
031 implements Logger
032 {
033
034 private org.slf4j.Logger logger;
035
036 public Slf4jLogger( org.slf4j.Logger logger )
037 {
038 this.logger = logger;
039 }
040
041 public void debug( String message )
042 {
043 logger.debug( message );
044 }
045
046 public void debug( String message, Throwable throwable )
047 {
048 logger.debug( message, throwable );
049 }
050
051 public boolean isDebugEnabled()
052 {
053 return logger.isDebugEnabled();
054 }
055
056 public void info( String message )
057 {
058 logger.info( message );
059 }
060
061 public void info( String message, Throwable throwable )
062 {
063 logger.info( message, throwable );
064 }
065
066 public boolean isInfoEnabled()
067 {
068 return logger.isInfoEnabled();
069 }
070
071 public void warn( String message )
072 {
073 logger.warn( message );
074 }
075
076 public void warn( String message, Throwable throwable )
077 {
078 logger.warn( message, throwable );
079 }
080
081 public boolean isWarnEnabled()
082 {
083 return logger.isWarnEnabled();
084 }
085
086 public void error( String message )
087 {
088 logger.error( message );
089 }
090
091 public void error( String message, Throwable throwable )
092 {
093 logger.error( message, throwable );
094 }
095
096 public boolean isErrorEnabled()
097 {
098 return logger.isErrorEnabled();
099 }
100
101 public void fatalError( String message )
102 {
103 logger.error( message );
104 }
105
106 public void fatalError( String message, Throwable throwable )
107 {
108 logger.error( message, throwable );
109 }
110
111 public boolean isFatalErrorEnabled()
112 {
113 return logger.isErrorEnabled();
114 }
115
116 /**
117 * <b>Warning</b>: ignored (always return <code>0 == Logger.LEVEL_DEBUG</code>).
118 */
119 public int getThreshold()
120 {
121 return 0;
122 }
123
124 /**
125 * <b>Warning</b>: ignored.
126 */
127 public void setThreshold( int threshold )
128 {
129 }
130
131 /**
132 * <b>Warning</b>: ignored (always return <code>null</code>).
133 */
134 public Logger getChildLogger( String name )
135 {
136 return null;
137 }
138
139 public String getName()
140 {
141 return logger.getName();
142 }
143
144 }