1 package org.apache.maven.shared.invoker; 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 * A logger used by {@link org.apache.maven.shared.invoker.Invoker} instances to output diagnostic messages. 24 * 25 * @see Invoker#setLogger(InvokerLogger) 26 * @author <a href="mailto:jason@maven.org">Jason van Zyl</a> 27 */ 28 public interface InvokerLogger 29 { 30 31 /** 32 * The threshold for debug output. 33 */ 34 int DEBUG = 4; 35 36 /** 37 * The threshold for info output. 38 */ 39 int INFO = 3; 40 41 /** 42 * The threshold for warn output. 43 */ 44 int WARN = 2; 45 46 /** 47 * The threshold for error output. 48 */ 49 int ERROR = 1; 50 51 /** 52 * The threshold for fatal error output. 53 */ 54 int FATAL = 0; 55 56 /** 57 * Logs the specified debug message. 58 * 59 * @param message The message to log, may be <code>null</code>. 60 */ 61 void debug( String message ); 62 63 /** 64 * Logs the specified debug message and the accompanying exception. 65 * 66 * @param message The message to log, may be <code>null</code>. 67 * @param throwable The exception to log, may be <code>null</code>. 68 */ 69 void debug( String message, Throwable throwable ); 70 71 /** 72 * Tests whether debug output is enabled for this logger. 73 * 74 * @return <code>true</code> if messages with priority "debug" or above are logged, <code>false</code> 75 * otherwise. 76 */ 77 boolean isDebugEnabled(); 78 79 /** 80 * Logs the specified info message. 81 * 82 * @param message The message to log, may be <code>null</code>. 83 */ 84 void info( String message ); 85 86 /** 87 * Logs the specified info message and the accompanying exception. 88 * 89 * @param message The message to log, may be <code>null</code>. 90 * @param throwable The exception to log, may be <code>null</code>. 91 */ 92 void info( String message, Throwable throwable ); 93 94 /** 95 * Tests whether info output is enabled for this logger. 96 * 97 * @return <code>true</code> if messages with priority "info" or above are logged, <code>false</code> otherwise. 98 */ 99 boolean isInfoEnabled(); 100 101 /** 102 * Logs the specified warning message. 103 * 104 * @param message The message to log, may be <code>null</code>. 105 */ 106 void warn( String message ); 107 108 /** 109 * Logs the specified warning message and the accompanying exception. 110 * 111 * @param message The message to log, may be <code>null</code>. 112 * @param throwable The exception to log, may be <code>null</code>. 113 */ 114 void warn( String message, Throwable throwable ); 115 116 /** 117 * Tests whether warn output is enabled for this logger. 118 * 119 * @return <code>true</code> if messages with priority "warn" or above are logged, <code>false</code> otherwise. 120 */ 121 boolean isWarnEnabled(); 122 123 /** 124 * Logs the specified error message. 125 * 126 * @param message The message to log, may be <code>null</code>. 127 */ 128 void error( String message ); 129 130 /** 131 * Logs the specified error message and the accompanying exception. 132 * 133 * @param message The message to log, may be <code>null</code>. 134 * @param throwable The exception to log, may be <code>null</code>. 135 */ 136 void error( String message, Throwable throwable ); 137 138 /** 139 * Tests whether error output is enabled for this logger. 140 * 141 * @return <code>true</code> if messages with priority "error" or above are logged, <code>false</code> 142 * otherwise. 143 */ 144 boolean isErrorEnabled(); 145 146 /** 147 * Logs the specified fatal error message. 148 * 149 * @param message The message to log, may be <code>null</code>. 150 */ 151 void fatalError( String message ); 152 153 /** 154 * Logs the specified fatal error message and the accompanying exception. 155 * 156 * @param message The message to log, may be <code>null</code>. 157 * @param throwable The exception to log, may be <code>null</code>. 158 */ 159 void fatalError( String message, Throwable throwable ); 160 161 /** 162 * Tests whether fatal error output is enabled for this logger. 163 * 164 * @return <code>true</code> if messages with priority "fatal" or above are logged, <code>false</code> 165 * otherwise. 166 */ 167 boolean isFatalErrorEnabled(); 168 169 /** 170 * Sets the logger's threshold. 171 * 172 * @param threshold The logger's threshold, must be one of {@link #DEBUG}, {@link #INFO}, {@link #WARN}, 173 * {@link #ERROR} and {@link #FATAL}. 174 */ 175 void setThreshold( int threshold ); 176 177 /** 178 * Gets the logger's threshold. 179 * 180 * @return The logger's threshold, one of {@link #DEBUG}, {@link #INFO}, {@link #WARN}, {@link #ERROR} and 181 * {@link #FATAL}. 182 */ 183 int getThreshold(); 184 185 }