View Javadoc
1   package org.apache.maven.plugin.logging;
2   
3   /*
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
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  /**
23   * This interface supplies the API for providing feedback to the user from the <code>Mojo</code>, using standard
24   * <code>Maven</code> channels.<br>
25   * There should be no big surprises here, although you may notice that the methods accept
26   * <code>java.lang.CharSequence</code> rather than <code>java.lang.String</code>. This is provided mainly as a
27   * convenience, to enable developers to pass things like <code>java.lang.StringBuffer</code> directly into the logger,
28   * rather than formatting first by calling <code>toString()</code>.
29   *
30   * @author jdcasey
31   */
32  public interface Log
33  {
34      /**
35       * @return true if the <b>debug</b> error level is enabled
36       */
37      boolean isDebugEnabled();
38  
39      /**
40       * Send a message to the user in the <b>debug</b> error level.
41       *
42       * @param content
43       */
44      void debug( CharSequence content );
45  
46      /**
47       * Send a message (and accompanying exception) to the user in the <b>debug</b> error level.<br>
48       * The error's stacktrace will be output when this error level is enabled.
49       *
50       * @param content
51       * @param error
52       */
53      void debug( CharSequence content, Throwable error );
54  
55      /**
56       * Send an exception to the user in the <b>debug</b> error level.<br>
57       * The stack trace for this exception will be output when this error level is enabled.
58       *
59       * @param error
60       */
61      void debug( Throwable error );
62  
63      /**
64       * @return true if the <b>info</b> error level is enabled
65       */
66      boolean isInfoEnabled();
67  
68      /**
69       * Send a message to the user in the <b>info</b> error level.
70       *
71       * @param content
72       */
73      void info( CharSequence content );
74  
75      /**
76       * Send a message (and accompanying exception) to the user in the <b>info</b> error level.<br>
77       * The error's stacktrace will be output when this error level is enabled.
78       *
79       * @param content
80       * @param error
81       */
82      void info( CharSequence content, Throwable error );
83  
84      /**
85       * Send an exception to the user in the <b>info</b> error level.<br>
86       * The stack trace for this exception will be output when this error level is enabled.
87       *
88       * @param error
89       */
90      void info( Throwable error );
91  
92      /**
93       * @return true if the <b>warn</b> error level is enabled
94       */
95      boolean isWarnEnabled();
96  
97      /**
98       * Send a message to the user in the <b>warn</b> error level.
99       *
100      * @param content
101      */
102     void warn( CharSequence content );
103 
104     /**
105      * Send a message (and accompanying exception) to the user in the <b>warn</b> error level.<br>
106      * The error's stacktrace will be output when this error level is enabled.
107      *
108      * @param content
109      * @param error
110      */
111     void warn( CharSequence content, Throwable error );
112 
113     /**
114      * Send an exception to the user in the <b>warn</b> error level.<br>
115      * The stack trace for this exception will be output when this error level is enabled.
116      *
117      * @param error
118      */
119     void warn( Throwable error );
120 
121     /**
122      * @return true if the <b>error</b> error level is enabled
123      */
124     boolean isErrorEnabled();
125 
126     /**
127      * Send a message to the user in the <b>error</b> error level.
128      *
129      * @param content
130      */
131     void error( CharSequence content );
132 
133     /**
134      * Send a message (and accompanying exception) to the user in the <b>error</b> error level.<br>
135      * The error's stacktrace will be output when this error level is enabled.
136      *
137      * @param content
138      * @param error
139      */
140     void error( CharSequence content, Throwable error );
141 
142     /**
143      * Send an exception to the user in the <b>error</b> error level.<br>
144      * The stack trace for this exception will be output when this error level is enabled.
145      *
146      * @param error
147      */
148     void error( Throwable error );
149 }