Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MojoLogWrapper |
|
| 1.105263157894737;1,105 |
1 | package org.apache.maven.doxia.tools; | |
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 | import org.apache.maven.doxia.logging.Log; | |
23 | ||
24 | /** | |
25 | * Wrap a Mojo logger into a Doxia logger. | |
26 | * | |
27 | * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a> | |
28 | * @version $Id: MojoLogWrapper.java 799000 2009-07-29 18:27:26Z ltheussl $ | |
29 | * @since 1.1 | |
30 | * @see org.apache.maven.plugin.logging.Log | |
31 | */ | |
32 | public class MojoLogWrapper | |
33 | implements Log | |
34 | { | |
35 | private final org.apache.maven.plugin.logging.Log mojoLog; | |
36 | ||
37 | /** | |
38 | * @param log a Mojo log | |
39 | */ | |
40 | public MojoLogWrapper( org.apache.maven.plugin.logging.Log log ) | |
41 | 0 | { |
42 | 0 | this.mojoLog = log; |
43 | 0 | } |
44 | ||
45 | /** {@inheritDoc} */ | |
46 | public void setLogLevel( int level ) | |
47 | { | |
48 | // nop | |
49 | 0 | } |
50 | ||
51 | /** {@inheritDoc} */ | |
52 | public void debug( CharSequence content ) | |
53 | { | |
54 | 0 | mojoLog.debug( toString( content ) ); |
55 | 0 | } |
56 | ||
57 | /** {@inheritDoc} */ | |
58 | public void debug( CharSequence content, Throwable error ) | |
59 | { | |
60 | 0 | mojoLog.debug( toString( content ), error ); |
61 | 0 | } |
62 | ||
63 | /** {@inheritDoc} */ | |
64 | public void debug( Throwable error ) | |
65 | { | |
66 | 0 | mojoLog.debug( "", error ); |
67 | 0 | } |
68 | ||
69 | /** {@inheritDoc} */ | |
70 | public void info( CharSequence content ) | |
71 | { | |
72 | 0 | mojoLog.info( toString( content ) ); |
73 | 0 | } |
74 | ||
75 | /** {@inheritDoc} */ | |
76 | public void info( CharSequence content, Throwable error ) | |
77 | { | |
78 | 0 | mojoLog.info( toString( content ), error ); |
79 | 0 | } |
80 | ||
81 | /** {@inheritDoc} */ | |
82 | public void info( Throwable error ) | |
83 | { | |
84 | 0 | mojoLog.info( "", error ); |
85 | 0 | } |
86 | ||
87 | /** {@inheritDoc} */ | |
88 | public void warn( CharSequence content ) | |
89 | { | |
90 | 0 | mojoLog.warn( toString( content ) ); |
91 | 0 | } |
92 | ||
93 | /** {@inheritDoc} */ | |
94 | public void warn( CharSequence content, Throwable error ) | |
95 | { | |
96 | 0 | mojoLog.warn( toString( content ), error ); |
97 | 0 | } |
98 | ||
99 | /** {@inheritDoc} */ | |
100 | public void warn( Throwable error ) | |
101 | { | |
102 | 0 | mojoLog.warn( "", error ); |
103 | 0 | } |
104 | ||
105 | /** {@inheritDoc} */ | |
106 | public void error( CharSequence content ) | |
107 | { | |
108 | 0 | mojoLog.error( toString( content ) ); |
109 | 0 | } |
110 | ||
111 | /** {@inheritDoc} */ | |
112 | public void error( CharSequence content, Throwable error ) | |
113 | { | |
114 | 0 | mojoLog.error( toString( content ), error ); |
115 | 0 | } |
116 | ||
117 | /** {@inheritDoc} */ | |
118 | public void error( Throwable error ) | |
119 | { | |
120 | 0 | mojoLog.error( "", error ); |
121 | 0 | } |
122 | ||
123 | /** {@inheritDoc} */ | |
124 | public boolean isDebugEnabled() | |
125 | { | |
126 | 0 | return mojoLog.isDebugEnabled(); |
127 | } | |
128 | ||
129 | /** {@inheritDoc} */ | |
130 | public boolean isInfoEnabled() | |
131 | { | |
132 | 0 | return mojoLog.isInfoEnabled(); |
133 | } | |
134 | ||
135 | /** {@inheritDoc} */ | |
136 | public boolean isWarnEnabled() | |
137 | { | |
138 | 0 | return mojoLog.isWarnEnabled(); |
139 | } | |
140 | ||
141 | /** {@inheritDoc} */ | |
142 | public boolean isErrorEnabled() | |
143 | { | |
144 | 0 | return mojoLog.isErrorEnabled(); |
145 | } | |
146 | ||
147 | // ---------------------------------------------------------------------- | |
148 | // Private methods | |
149 | // ---------------------------------------------------------------------- | |
150 | ||
151 | private String toString( CharSequence content ) | |
152 | { | |
153 | 0 | if ( content == null ) |
154 | { | |
155 | 0 | return ""; |
156 | } | |
157 | ||
158 | 0 | return content.toString(); |
159 | } | |
160 | } |