View Javadoc

1   /*
2    * Copyright 2012 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.ci.maven; // NOPMD
17  
18  import org.apache.maven.plugin.logging.Log;
19  import org.slf4j.Marker;
20  
21  /**
22   * Bridge to the slf4j Logger.
23   */
24  public final class Logger implements org.slf4j.Logger, Log // NOPMD
25  { // NOPMD
26    // ********************************* Fields *********************************
27  
28    // --- constants ------------------------------------------------------------
29  
30    // --- members --------------------------------------------------------------
31  
32    /**
33     * The underlaying maven log.
34     */
35    private final Log log;
36  
37    // ****************************** Initializer *******************************
38  
39    // ****************************** Constructors ******************************
40  
41    /**
42     * Default constructor.
43     *
44     * @param log the maven log facility.
45     */
46    public Logger(final Log log)
47    {
48      this.log = log;
49    }
50  
51    // ****************************** Inner Classes *****************************
52  
53    // ********************************* Methods ********************************
54  
55    // --- init -----------------------------------------------------------------
56  
57    // --- get&set --------------------------------------------------------------
58  
59    // --- business -------------------------------------------------------------
60  
61    @Override
62    public String getName()
63    {
64      return log.getClass().getName();
65    }
66  
67    @Override
68    public boolean isTraceEnabled()
69    {
70      return log.isDebugEnabled();
71    }
72  
73    @Override
74    public void trace(final String msg)
75    {
76      log.debug(msg);
77    }
78  
79    @Override
80    public void trace(final String format, final Object arg)
81    {
82      throw new UnsupportedOperationException();
83    }
84  
85    @Override
86    public void trace(final String format, final Object arg1, final Object arg2)
87    {
88      throw new UnsupportedOperationException();
89    }
90  
91    @Override
92    public void trace(final String format, final Object[] argArray)
93    {
94      throw new UnsupportedOperationException();
95    }
96  
97    @Override
98    public void trace(final String msg, final Throwable t)
99    {
100     if (t == null)
101     {
102       log.debug(msg);
103     }
104     else
105     {
106       log.debug(msg, t);
107     }
108   }
109 
110   @Override
111   public boolean isTraceEnabled(final Marker marker)
112   {
113     throw new UnsupportedOperationException();
114   }
115 
116   @Override
117   public void trace(final Marker marker, final String msg)
118   {
119     throw new UnsupportedOperationException();
120   }
121 
122   @Override
123   public void trace(final Marker marker, final String format, final Object arg)
124   {
125     throw new UnsupportedOperationException();
126   }
127 
128   @Override
129   public void trace(final Marker marker, final String format,
130       final Object arg1, final Object arg2)
131   {
132     throw new UnsupportedOperationException();
133   }
134 
135   @Override
136   public void trace(final Marker marker, final String format,
137       final Object[] argArray)
138   {
139     throw new UnsupportedOperationException();
140   }
141 
142   @Override
143   public void trace(final Marker marker, final String msg, final Throwable t)
144   {
145     throw new UnsupportedOperationException();
146   }
147 
148   @Override
149   public boolean isDebugEnabled()
150   {
151     return log.isDebugEnabled();
152   }
153 
154   @Override
155   public void debug(final String msg)
156   {
157     log.debug(msg);
158   }
159 
160   @Override
161   public void debug(final String format, final Object arg)
162   {
163     throw new UnsupportedOperationException();
164   }
165 
166   @Override
167   public void debug(final String format, final Object arg1, final Object arg2)
168   {
169     throw new UnsupportedOperationException();
170   }
171 
172   @Override
173   public void debug(final String format, final Object[] argArray)
174   {
175     throw new UnsupportedOperationException();
176   }
177 
178   @Override
179   public void debug(final String msg, final Throwable t)
180   {
181     if (t == null)
182     {
183       log.debug(msg);
184     }
185     else
186     {
187       log.debug(msg, t);
188     }
189   }
190 
191   @Override
192   public boolean isDebugEnabled(final Marker marker)
193   {
194     throw new UnsupportedOperationException();
195   }
196 
197   @Override
198   public void debug(final Marker marker, final String msg)
199   {
200     throw new UnsupportedOperationException();
201   }
202 
203   @Override
204   public void debug(final Marker marker, final String format, final Object arg)
205   {
206     throw new UnsupportedOperationException();
207   }
208 
209   @Override
210   public void debug(final Marker marker, final String format,
211       final Object arg1, final Object arg2)
212   {
213     throw new UnsupportedOperationException();
214   }
215 
216   @Override
217   public void debug(final Marker marker, final String format,
218       final Object[] argArray)
219   {
220     throw new UnsupportedOperationException();
221   }
222 
223   @Override
224   public void debug(final Marker marker, final String msg, final Throwable t)
225   {
226     throw new UnsupportedOperationException();
227   }
228 
229   @Override
230   public boolean isInfoEnabled()
231   {
232     return log.isInfoEnabled();
233   }
234 
235   @Override
236   public void info(final String msg)
237   {
238     log.info(msg);
239   }
240 
241   @Override
242   public void info(final String format, final Object arg)
243   {
244     throw new UnsupportedOperationException();
245   }
246 
247   @Override
248   public void info(final String format, final Object arg1, final Object arg2)
249   {
250     throw new UnsupportedOperationException();
251   }
252 
253   @Override
254   public void info(final String format, final Object[] argArray)
255   {
256     throw new UnsupportedOperationException();
257   }
258 
259   @Override
260   public void info(final String msg, final Throwable t)
261   {
262     if (t == null)
263     {
264       log.info(msg);
265     }
266     else
267     {
268       log.info(msg, t);
269     }
270   }
271 
272   @Override
273   public boolean isInfoEnabled(final Marker marker)
274   {
275     throw new UnsupportedOperationException();
276   }
277 
278   @Override
279   public void info(final Marker marker, final String msg)
280   {
281     throw new UnsupportedOperationException();
282   }
283 
284   @Override
285   public void info(final Marker marker, final String format, final Object arg)
286   {
287     throw new UnsupportedOperationException();
288   }
289 
290   @Override
291   public void info(final Marker marker, final String format, final Object arg1,
292       final Object arg2)
293   {
294     throw new UnsupportedOperationException();
295   }
296 
297   @Override
298   public void info(final Marker marker, final String format,
299       final Object[] argArray)
300   {
301     throw new UnsupportedOperationException();
302   }
303 
304   @Override
305   public void info(final Marker marker, final String msg, final Throwable t)
306   {
307     throw new UnsupportedOperationException();
308   }
309 
310   @Override
311   public boolean isWarnEnabled()
312   {
313     return log.isWarnEnabled();
314   }
315 
316   @Override
317   public void warn(final String msg)
318   {
319     log.warn(msg);
320   }
321 
322   @Override
323   public void warn(final String format, final Object arg)
324   {
325     throw new UnsupportedOperationException();
326   }
327 
328   @Override
329   public void warn(final String format, final Object[] argArray)
330   {
331     throw new UnsupportedOperationException();
332   }
333 
334   @Override
335   public void warn(final String format, final Object arg1, final Object arg2)
336   {
337     throw new UnsupportedOperationException();
338   }
339 
340   @Override
341   public void warn(final String msg, final Throwable t)
342   {
343     if (t == null)
344     {
345       log.warn(msg);
346     }
347     else
348     {
349       log.warn(msg, t);
350     }
351   }
352 
353   @Override
354   public boolean isWarnEnabled(final Marker marker)
355   {
356     throw new UnsupportedOperationException();
357   }
358 
359   @Override
360   public void warn(final Marker marker, final String msg)
361   {
362     throw new UnsupportedOperationException();
363   }
364 
365   @Override
366   public void warn(final Marker marker, final String format, final Object arg)
367   {
368     throw new UnsupportedOperationException();
369   }
370 
371   @Override
372   public void warn(final Marker marker, final String format, final Object arg1,
373       final Object arg2)
374   {
375     throw new UnsupportedOperationException();
376   }
377 
378   @Override
379   public void warn(final Marker marker, final String format,
380       final Object[] argArray)
381   {
382     throw new UnsupportedOperationException();
383   }
384 
385   @Override
386   public void warn(final Marker marker, final String msg, final Throwable t)
387   {
388     throw new UnsupportedOperationException();
389   }
390 
391   @Override
392   public boolean isErrorEnabled()
393   {
394     return log.isErrorEnabled();
395   }
396 
397   @Override
398   public void error(final String msg)
399   {
400     log.error(msg);
401   }
402 
403   @Override
404   public void error(final String format, final Object arg)
405   {
406     throw new UnsupportedOperationException();
407   }
408 
409   @Override
410   public void error(final String format, final Object arg1, final Object arg2)
411   {
412     throw new UnsupportedOperationException();
413   }
414 
415   @Override
416   public void error(final String format, final Object[] argArray)
417   {
418     throw new UnsupportedOperationException();
419   }
420 
421   @Override
422   public void error(final String msg, final Throwable t)
423   {
424     if (t == null)
425     {
426       log.error(msg);
427     }
428     else
429     {
430       log.error(msg, t);
431     }
432   }
433 
434   @Override
435   public boolean isErrorEnabled(final Marker marker)
436   {
437     throw new UnsupportedOperationException();
438   }
439 
440   @Override
441   public void error(final Marker marker, final String msg)
442   {
443     throw new UnsupportedOperationException();
444   }
445 
446   @Override
447   public void error(final Marker marker, final String format, final Object arg)
448   {
449     throw new UnsupportedOperationException();
450   }
451 
452   @Override
453   public void error(final Marker marker, final String format,
454       final Object arg1, final Object arg2)
455   {
456     throw new UnsupportedOperationException();
457   }
458 
459   @Override
460   public void error(final Marker marker, final String format,
461       final Object[] argArray)
462   {
463     throw new UnsupportedOperationException();
464   }
465 
466   @Override
467   public void error(final Marker marker, final String msg, final Throwable t)
468   {
469     throw new UnsupportedOperationException();
470   }
471 
472   @Override
473   public void debug(final CharSequence content)
474   {
475     log.debug(content);
476   }
477 
478   @Override
479   public void debug(final CharSequence content, final Throwable t)
480   {
481     if (t == null)
482     {
483       log.debug(content);
484     }
485     else
486     {
487       log.debug(content, t);
488     }
489   }
490 
491   @Override
492   public void debug(final Throwable error)
493   {
494     log.debug(error);
495   }
496 
497   @Override
498   public void info(final CharSequence content)
499   {
500     log.info(content);
501   }
502 
503   @Override
504   public void info(final CharSequence content, final Throwable t)
505   {
506     if (t == null)
507     {
508       log.info(content);
509     }
510     else
511     {
512       log.info(content, t);
513     }
514   }
515 
516   @Override
517   public void info(final Throwable error)
518   {
519     log.info(error);
520   }
521 
522   @Override
523   public void warn(final CharSequence content)
524   {
525     log.warn(content);
526   }
527 
528   @Override
529   public void warn(final CharSequence content, final Throwable t)
530   {
531     if (t == null)
532     {
533       log.warn(content);
534     }
535     else
536     {
537       log.warn(content, t);
538     }
539   }
540 
541   @Override
542   public void warn(final Throwable error)
543   {
544     log.warn(error);
545   }
546 
547   @Override
548   public void error(final CharSequence content)
549   {
550     log.error(content);
551   }
552 
553   @Override
554   public void error(final CharSequence content, final Throwable t)
555   {
556     if (t == null)
557     {
558       log.error(content);
559     }
560     else
561     {
562       log.error(content, t);
563     }
564   }
565 
566   @Override
567   public void error(final Throwable error)
568   {
569     log.error(error);
570   }
571 
572   // --- final Object basics
573   // --------------------------------------------------------
574 
575 }