001    package org.apache.maven.plugin.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    /**
023     * This interface supplies the API for providing feedback to the user from the <code>Mojo</code>, using standard
024     * <code>Maven</code> channels.
025     * <br/>
026     * There should be no big surprises here, although you may notice that the methods accept
027     * <code>java.lang.CharSequence</code> rather than <code>java.lang.String</code>. This is provided mainly as a
028     * convenience, to enable developers to pass things like <code>java.lang.StringBuffer</code> directly into the logger,
029     * rather than formatting first by calling <code>toString()</code>.
030     *
031     * @author jdcasey
032     */
033    public interface Log
034    {
035        /**
036         * @return true if the <b>debug</b> error level is enabled
037         */
038        boolean isDebugEnabled();
039    
040        /**
041         * Send a message to the user in the <b>debug</b> error level.
042         *
043         * @param content
044         */
045        void debug( CharSequence content );
046    
047        /**
048         * Send a message (and accompanying exception) to the user in the <b>debug</b> error level.
049         * <br/>
050         * The error's stacktrace will be output when this error level is enabled.
051         *
052         * @param content
053         * @param error
054         */
055        void debug( CharSequence content, Throwable error );
056    
057        /**
058         * Send an exception to the user in the <b>debug</b> error level.
059         * <br/>
060         * The stack trace for this exception will be output when this error level is enabled.
061         *
062         * @param error
063         */
064        void debug( Throwable error );
065    
066        /**
067         * @return true if the <b>info</b> error level is enabled
068         */
069        boolean isInfoEnabled();
070    
071        /**
072         * Send a message to the user in the <b>info</b> error level.
073         *
074         * @param content
075         */
076        void info( CharSequence content );
077    
078        /**
079         * Send a message (and accompanying exception) to the user in the <b>info</b> error level.
080         * <br/>
081         * The error's stacktrace will be output when this error level is enabled.
082         *
083         * @param content
084         * @param error
085         */
086        void info( CharSequence content, Throwable error );
087    
088        /**
089         * Send an exception to the user in the <b>info</b> error level.
090         * <br/>
091         * The stack trace for this exception will be output when this error level is enabled.
092         *
093         * @param error
094         */
095        void info( Throwable error );
096    
097        /**
098         * @return true if the <b>warn</b> error level is enabled
099         */
100        boolean isWarnEnabled();
101    
102        /**
103         * Send a message to the user in the <b>warn</b> error level.
104         *
105         * @param content
106         */
107        void warn( CharSequence content );
108    
109        /**
110         * Send a message (and accompanying exception) to the user in the <b>warn</b> error level.
111         * <br/>
112         * The error's stacktrace will be output when this error level is enabled.
113         *
114         * @param content
115         * @param error
116         */
117        void warn( CharSequence content, Throwable error );
118    
119        /**
120         * Send an exception to the user in the <b>warn</b> error level.
121         * <br/>
122         * The stack trace for this exception will be output when this error level is enabled.
123         *
124         * @param error
125         */
126        void warn( Throwable error );
127    
128        /**
129         * @return true if the <b>error</b> error level is enabled
130         */
131        boolean isErrorEnabled();
132    
133        /**
134         * Send a message to the user in the <b>error</b> error level.
135         *
136         * @param content
137         */
138        void error( CharSequence content );
139    
140        /**
141         * Send a message (and accompanying exception) to the user in the <b>error</b> error level.
142         * <br/>
143         * The error's stacktrace will be output when this error level is enabled.
144         *
145         * @param content
146         * @param error
147         */
148        void error( CharSequence content, Throwable error );
149    
150        /**
151         * Send an exception to the user in the <b>error</b> error level.
152         * <br/>
153         * The stack trace for this exception will be output when this error level is enabled.
154         *
155         * @param error
156         */
157        void error( Throwable error );
158    }