001    package org.apache.maven.monitor.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.apache.maven.plugin.logging.Log;
023    import org.codehaus.plexus.logging.Logger;
024    
025    /**
026     * @author jdcasey
027     */
028    public class DefaultLog
029        implements Log
030    {
031    
032        private final Logger logger;
033    
034        public DefaultLog( Logger logger )
035        {
036            this.logger = logger;
037        }
038    
039        public void debug( CharSequence content )
040        {
041            logger.debug( toString( content ) );
042        }
043    
044        private String toString( CharSequence content )
045        {
046            if ( content == null )
047            {
048                return "";
049            }
050            else
051            {
052                return content.toString();
053            }
054        }
055    
056        public void debug( CharSequence content, Throwable error )
057        {
058            logger.debug( toString( content ), error );
059        }
060    
061        public void debug( Throwable error )
062        {
063            logger.debug( "", error );
064        }
065    
066        public void info( CharSequence content )
067        {
068            logger.info( toString( content ) );
069        }
070    
071        public void info( CharSequence content, Throwable error )
072        {
073            logger.info( toString( content ), error );
074        }
075    
076        public void info( Throwable error )
077        {
078            logger.info( "", error );
079        }
080    
081        public void warn( CharSequence content )
082        {
083            logger.warn( toString( content ) );
084        }
085    
086        public void warn( CharSequence content, Throwable error )
087        {
088            logger.warn( toString( content ), error );
089        }
090    
091        public void warn( Throwable error )
092        {
093            logger.warn( "", error );
094        }
095    
096        public void error( CharSequence content )
097        {
098            logger.error( toString( content ) );
099        }
100    
101        public void error( CharSequence content, Throwable error )
102        {
103            logger.error( toString( content ), error );
104        }
105    
106        public void error( Throwable error )
107        {
108            logger.error( "", error );
109        }
110    
111        public boolean isDebugEnabled()
112        {
113            return logger.isDebugEnabled();
114        }
115    
116        public boolean isInfoEnabled()
117        {
118            return logger.isInfoEnabled();
119        }
120    
121        public boolean isWarnEnabled()
122        {
123            return logger.isWarnEnabled();
124        }
125    
126        public boolean isErrorEnabled()
127        {
128            return logger.isErrorEnabled();
129        }
130    
131    }