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.
25 * <br/>
26 * There should be no big surprises here, although you may notice that the methods accept
27 * <code>java.lang.CharSequence</code> rather than <code>java.lang.String</code>. This is provided mainly as a
28 * convenience, to enable developers to pass things like <code>java.lang.StringBuffer</code> directly into the logger,
29 * rather than formatting first by calling <code>toString()</code>.
30 *
31 * @author jdcasey
32 */
33 public interface Log
34 {
35 /**
36 * @return true if the <b>debug</b> error level is enabled
37 */
38 boolean isDebugEnabled();
39
40 /**
41 * Send a message to the user in the <b>debug</b> error level.
42 *
43 * @param content
44 */
45 void debug( CharSequence content );
46
47 /**
48 * Send a message (and accompanying exception) to the user in the <b>debug</b> error level.
49 * <br/>
50 * The error's stacktrace will be output when this error level is enabled.
51 *
52 * @param content
53 * @param error
54 */
55 void debug( CharSequence content, Throwable error );
56
57 /**
58 * Send an exception to the user in the <b>debug</b> error level.
59 * <br/>
60 * The stack trace for this exception will be output when this error level is enabled.
61 *
62 * @param error
63 */
64 void debug( Throwable error );
65
66 /**
67 * @return true if the <b>info</b> error level is enabled
68 */
69 boolean isInfoEnabled();
70
71 /**
72 * Send a message to the user in the <b>info</b> error level.
73 *
74 * @param content
75 */
76 void info( CharSequence content );
77
78 /**
79 * Send a message (and accompanying exception) to the user in the <b>info</b> error level.
80 * <br/>
81 * The error's stacktrace will be output when this error level is enabled.
82 *
83 * @param content
84 * @param error
85 */
86 void info( CharSequence content, Throwable error );
87
88 /**
89 * Send an exception to the user in the <b>info</b> error level.
90 * <br/>
91 * The stack trace for this exception will be output when this error level is enabled.
92 *
93 * @param error
94 */
95 void info( Throwable error );
96
97 /**
98 * @return true if the <b>warn</b> error level is enabled
99 */
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 }