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