1 package org.apache.maven.doxia.logging;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.codehaus.plexus.logging.Logger;
23
24
25
26
27
28
29
30
31 public class PlexusLoggerWrapper
32 implements Log
33 {
34 private final Logger logger;
35
36
37
38
39
40
41 public PlexusLoggerWrapper( Logger logger )
42 {
43 this.logger = logger;
44 }
45
46
47 public void setLogLevel( int level )
48 {
49 if ( level <= LEVEL_DEBUG )
50 {
51 logger.setThreshold( Logger.LEVEL_DEBUG );
52 }
53 else if ( level <= LEVEL_INFO )
54 {
55 logger.setThreshold( Logger.LEVEL_INFO );
56 }
57 else if ( level <= LEVEL_WARN )
58 {
59 logger.setThreshold( Logger.LEVEL_WARN );
60 }
61 else if ( level <= LEVEL_ERROR )
62 {
63 logger.setThreshold( Logger.LEVEL_ERROR );
64 }
65 else
66 {
67 logger.setThreshold( Logger.LEVEL_DISABLED );
68 }
69 }
70
71
72
73
74
75
76 public void debug( CharSequence content )
77 {
78 logger.debug( toString( content ) );
79 }
80
81
82 public void debug( CharSequence content, Throwable error )
83 {
84 logger.debug( toString( content ), error );
85 }
86
87
88 public void debug( Throwable error )
89 {
90 logger.debug( "", error );
91 }
92
93
94 public void info( CharSequence content )
95 {
96 logger.info( toString( content ) );
97 }
98
99
100 public void info( CharSequence content, Throwable error )
101 {
102 logger.info( toString( content ), error );
103 }
104
105
106
107
108
109
110 public void info( Throwable error )
111 {
112 logger.info( "", error );
113 }
114
115
116
117
118
119
120 public void warn( CharSequence content )
121 {
122 logger.warn( toString( content ) );
123 }
124
125
126 public void warn( CharSequence content, Throwable error )
127 {
128 logger.warn( toString( content ), error );
129 }
130
131
132 public void warn( Throwable error )
133 {
134 logger.warn( "", error );
135 }
136
137
138 public void error( CharSequence content )
139 {
140 logger.error( toString( content ) );
141 }
142
143
144 public void error( CharSequence content, Throwable error )
145 {
146 logger.error( toString( content ), error );
147 }
148
149
150
151
152
153
154 public void error( Throwable error )
155 {
156 logger.error( "", error );
157 }
158
159
160
161
162
163
164 public boolean isDebugEnabled()
165 {
166 return logger.isDebugEnabled();
167 }
168
169
170
171
172
173
174 public boolean isInfoEnabled()
175 {
176 return logger.isInfoEnabled();
177 }
178
179
180
181
182
183
184 public boolean isWarnEnabled()
185 {
186 return logger.isWarnEnabled();
187 }
188
189
190
191
192
193
194 public boolean isErrorEnabled()
195 {
196 return logger.isErrorEnabled();
197 }
198
199
200
201
202
203 private String toString( CharSequence content )
204 {
205 if ( content == null )
206 {
207 return "";
208 }
209
210 return content.toString();
211 }
212 }