1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.shared.invoker;
20
21 /**
22 * A logger used by {@link org.apache.maven.shared.invoker.Invoker} instances to output diagnostic messages.
23 *
24 * @see Invoker#setLogger(InvokerLogger)
25 * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
26 */
27 public interface InvokerLogger {
28
29 /**
30 * The threshold for debug output.
31 */
32 int DEBUG = 4;
33
34 /**
35 * The threshold for info output.
36 */
37 int INFO = 3;
38
39 /**
40 * The threshold for warn output.
41 */
42 int WARN = 2;
43
44 /**
45 * The threshold for error output.
46 */
47 int ERROR = 1;
48
49 /**
50 * The threshold for fatal error output.
51 */
52 int FATAL = 0;
53
54 /**
55 * Logs the specified debug message.
56 *
57 * @param message The message to log, may be <code>null</code>.
58 */
59 void debug(String message);
60
61 /**
62 * Logs the specified debug message and the accompanying exception.
63 *
64 * @param message The message to log, may be <code>null</code>.
65 * @param throwable The exception to log, may be <code>null</code>.
66 */
67 void debug(String message, Throwable throwable);
68
69 /**
70 * Tests whether debug output is enabled for this logger.
71 *
72 * @return <code>true</code> if messages with priority "debug" or above are logged, <code>false</code>
73 * otherwise.
74 */
75 boolean isDebugEnabled();
76
77 /**
78 * Logs the specified info message.
79 *
80 * @param message The message to log, may be <code>null</code>.
81 */
82 void info(String message);
83
84 /**
85 * Logs the specified info message and the accompanying exception.
86 *
87 * @param message The message to log, may be <code>null</code>.
88 * @param throwable The exception to log, may be <code>null</code>.
89 */
90 void info(String message, Throwable throwable);
91
92 /**
93 * Tests whether info output is enabled for this logger.
94 *
95 * @return <code>true</code> if messages with priority "info" or above are logged, <code>false</code> otherwise.
96 */
97 boolean isInfoEnabled();
98
99 /**
100 * Logs the specified warning message.
101 *
102 * @param message The message to log, may be <code>null</code>.
103 */
104 void warn(String message);
105
106 /**
107 * Logs the specified warning message and the accompanying exception.
108 *
109 * @param message The message to log, may be <code>null</code>.
110 * @param throwable The exception to log, may be <code>null</code>.
111 */
112 void warn(String message, Throwable throwable);
113
114 /**
115 * Tests whether warn output is enabled for this logger.
116 *
117 * @return <code>true</code> if messages with priority "warn" or above are logged, <code>false</code> otherwise.
118 */
119 boolean isWarnEnabled();
120
121 /**
122 * Logs the specified error message.
123 *
124 * @param message The message to log, may be <code>null</code>.
125 */
126 void error(String message);
127
128 /**
129 * Logs the specified error message and the accompanying exception.
130 *
131 * @param message The message to log, may be <code>null</code>.
132 * @param throwable The exception to log, may be <code>null</code>.
133 */
134 void error(String message, Throwable throwable);
135
136 /**
137 * Tests whether error output is enabled for this logger.
138 *
139 * @return <code>true</code> if messages with priority "error" or above are logged, <code>false</code>
140 * otherwise.
141 */
142 boolean isErrorEnabled();
143
144 /**
145 * Logs the specified fatal error message.
146 *
147 * @param message The message to log, may be <code>null</code>.
148 */
149 void fatalError(String message);
150
151 /**
152 * Logs the specified fatal error message and the accompanying exception.
153 *
154 * @param message The message to log, may be <code>null</code>.
155 * @param throwable The exception to log, may be <code>null</code>.
156 */
157 void fatalError(String message, Throwable throwable);
158
159 /**
160 * Tests whether fatal error output is enabled for this logger.
161 *
162 * @return <code>true</code> if messages with priority "fatal" or above are logged, <code>false</code>
163 * otherwise.
164 */
165 boolean isFatalErrorEnabled();
166
167 /**
168 * Sets the logger's threshold.
169 *
170 * @param threshold The logger's threshold, must be one of {@link #DEBUG}, {@link #INFO}, {@link #WARN},
171 * {@link #ERROR} and {@link #FATAL}.
172 */
173 void setThreshold(int threshold);
174
175 /**
176 * Gets the logger's threshold.
177 *
178 * @return The logger's threshold, one of {@link #DEBUG}, {@link #INFO}, {@link #WARN}, {@link #ERROR} and
179 * {@link #FATAL}.
180 */
181 int getThreshold();
182 }