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.plugin.testing; 20 21 import org.apache.maven.plugin.logging.Log; 22 import org.codehaus.plexus.logging.Logger; 23 24 /** 25 * This logger implements both types of logs currently in use. It can be injected where needed 26 * to turn off logs during testing where they aren't desired. 27 * 28 * @author <a href="mailto:brianf@apache.org">Brian Fox</a> 29 */ 30 public class SilentLog implements Log, Logger { 31 /** 32 * @return <code>false</code> 33 * @see org.apache.maven.plugin.logging.Log#isDebugEnabled() 34 */ 35 @Override 36 public boolean isDebugEnabled() { 37 return false; 38 } 39 40 /** 41 * By default, do nothing. 42 * 43 * @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence) 44 */ 45 @Override 46 public void debug(CharSequence content) { 47 // nop 48 } 49 50 /** 51 * By default, do nothing. 52 * 53 * @see org.apache.maven.plugin.logging.Log#debug(java.lang.CharSequence, java.lang.Throwable) 54 */ 55 @Override 56 public void debug(CharSequence content, Throwable error) { 57 // nop 58 } 59 60 /** 61 * By default, do nothing. 62 * 63 * @see org.apache.maven.plugin.logging.Log#debug(java.lang.Throwable) 64 */ 65 @Override 66 public void debug(Throwable error) { 67 // nop 68 } 69 70 /** 71 * @return <code>false</code> 72 * @see org.apache.maven.plugin.logging.Log#isInfoEnabled() 73 */ 74 @Override 75 public boolean isInfoEnabled() { 76 return false; 77 } 78 79 /** 80 * By default, do nothing. 81 * 82 * @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence) 83 */ 84 @Override 85 public void info(CharSequence content) { 86 // nop 87 } 88 89 /** 90 * By default, do nothing. 91 * 92 * @see org.apache.maven.plugin.logging.Log#info(java.lang.CharSequence, java.lang.Throwable) 93 */ 94 @Override 95 public void info(CharSequence content, Throwable error) { 96 // nop 97 } 98 99 /** 100 * By default, do nothing. 101 * 102 * @see org.apache.maven.plugin.logging.Log#info(java.lang.Throwable) 103 */ 104 @Override 105 public void info(Throwable error) { 106 // nop 107 } 108 109 /** 110 * By default, do nothing. 111 * 112 * @see org.apache.maven.plugin.logging.Log#isWarnEnabled() 113 */ 114 @Override 115 public boolean isWarnEnabled() { 116 // nop 117 return false; 118 } 119 120 /** 121 * By default, do nothing. 122 * 123 * @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence) 124 */ 125 @Override 126 public void warn(CharSequence content) { 127 // nop 128 } 129 130 /** 131 * By default, do nothing. 132 * 133 * @see org.apache.maven.plugin.logging.Log#warn(java.lang.CharSequence, java.lang.Throwable) 134 */ 135 @Override 136 public void warn(CharSequence content, Throwable error) { 137 // nop 138 } 139 140 /** 141 * By default, do nothing. 142 * 143 * @see org.apache.maven.plugin.logging.Log#warn(java.lang.Throwable) 144 */ 145 @Override 146 public void warn(Throwable error) { 147 // nop 148 } 149 150 /** 151 * @return <code>false</code> 152 * @see org.apache.maven.plugin.logging.Log#isErrorEnabled() 153 */ 154 @Override 155 public boolean isErrorEnabled() { 156 return false; 157 } 158 159 /** 160 * By default, do nothing. 161 * 162 * @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence) 163 */ 164 @Override 165 public void error(CharSequence content) { 166 // nop 167 } 168 169 /** 170 * By default, do nothing. 171 * 172 * @see org.apache.maven.plugin.logging.Log#error(java.lang.CharSequence, java.lang.Throwable) 173 */ 174 @Override 175 public void error(CharSequence content, Throwable error) { 176 // nop 177 } 178 179 /** 180 * By default, do nothing. 181 * 182 * @see org.apache.maven.plugin.logging.Log#error(java.lang.Throwable) 183 */ 184 @Override 185 public void error(Throwable error) { 186 // nop 187 } 188 189 /** 190 * By default, do nothing. 191 * 192 * @see org.codehaus.plexus.logging.Logger#debug(java.lang.String) 193 */ 194 @Override 195 public void debug(String message) { 196 // nop 197 } 198 199 /** 200 * By default, do nothing. 201 * 202 * @see org.codehaus.plexus.logging.Logger#debug(java.lang.String, java.lang.Throwable) 203 */ 204 @Override 205 public void debug(String message, Throwable throwable) { 206 // nop 207 } 208 209 /** 210 * By default, do nothing. 211 * 212 * @see org.codehaus.plexus.logging.Logger#info(java.lang.String) 213 */ 214 @Override 215 public void info(String message) { 216 // nop 217 } 218 219 /** 220 * By default, do nothing. 221 * 222 * @see org.codehaus.plexus.logging.Logger#info(java.lang.String, java.lang.Throwable) 223 */ 224 @Override 225 public void info(String message, Throwable throwable) { 226 // nop 227 } 228 229 /** 230 * By default, do nothing. 231 * 232 * @see org.codehaus.plexus.logging.Logger#warn(java.lang.String) 233 */ 234 @Override 235 public void warn(String message) { 236 // nop 237 } 238 239 /** 240 * By default, do nothing. 241 * 242 * @see org.codehaus.plexus.logging.Logger#warn(java.lang.String, java.lang.Throwable) 243 */ 244 @Override 245 public void warn(String message, Throwable throwable) { 246 // nop 247 } 248 249 /** 250 * By default, do nothing. 251 * 252 * @see org.codehaus.plexus.logging.Logger#error(java.lang.String) 253 */ 254 @Override 255 public void error(String message) { 256 // nop 257 } 258 259 /** 260 * By default, do nothing. 261 * 262 * @see org.codehaus.plexus.logging.Logger#error(java.lang.String, java.lang.Throwable) 263 */ 264 @Override 265 public void error(String message, Throwable throwable) { 266 // nop 267 } 268 269 /** 270 * By default, do nothing. 271 * 272 * @see org.codehaus.plexus.logging.Logger#fatalError(java.lang.String) 273 */ 274 @Override 275 public void fatalError(String message) { 276 // nop 277 } 278 279 /** 280 * By default, do nothing. 281 * 282 * @see org.codehaus.plexus.logging.Logger#fatalError(java.lang.String, java.lang.Throwable) 283 */ 284 @Override 285 public void fatalError(String message, Throwable throwable) { 286 // nop 287 } 288 289 /** 290 * @return <code>false</code> 291 * @see org.codehaus.plexus.logging.Logger#isFatalErrorEnabled() 292 */ 293 @Override 294 public boolean isFatalErrorEnabled() { 295 return false; 296 } 297 298 /** 299 * @return <code>null</code> 300 * @see org.codehaus.plexus.logging.Logger#getChildLogger(java.lang.String) 301 */ 302 @Override 303 public Logger getChildLogger(String name) { 304 return null; 305 } 306 307 /** 308 * @return <code>0</code> 309 * @see org.codehaus.plexus.logging.Logger#getThreshold() 310 */ 311 @Override 312 public int getThreshold() { 313 return 0; 314 } 315 316 /** 317 * @return <code>null</code> 318 * @see org.codehaus.plexus.logging.Logger#getName() 319 */ 320 @Override 321 public String getName() { 322 return null; 323 } 324 325 @Override 326 public void setThreshold(int threshold) { 327 // TODO Auto-generated method stub 328 329 } 330 }