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
32 public class PlexusLoggerWrapper
33 implements Log
34 {
35 private final Logger logger;
36
37
38
39
40
41
42 public PlexusLoggerWrapper( Logger logger )
43 {
44 this.logger = logger;
45 }
46
47
48 public void setLogLevel( int level )
49 {
50 if ( level <= LEVEL_DEBUG )
51 {
52 logger.setThreshold( Logger.LEVEL_DEBUG );
53 }
54 else if ( level <= LEVEL_INFO )
55 {
56 logger.setThreshold( Logger.LEVEL_INFO );
57 }
58 else if ( level <= LEVEL_WARN )
59 {
60 logger.setThreshold( Logger.LEVEL_WARN );
61 }
62 else if ( level <= LEVEL_ERROR )
63 {
64 logger.setThreshold( Logger.LEVEL_ERROR );
65 }
66 else
67 {
68 logger.setThreshold( Logger.LEVEL_DISABLED );
69 }
70 }
71
72
73 public void debug( CharSequence content )
74 {
75 logger.debug( toString( content ) );
76 }
77
78
79 public void debug( CharSequence content, Throwable error )
80 {
81 logger.debug( toString( content ), error );
82 }
83
84
85 public void debug( Throwable error )
86 {
87 logger.debug( "", error );
88 }
89
90
91 public void info( CharSequence content )
92 {
93 logger.info( toString( content ) );
94 }
95
96
97 public void info( CharSequence content, Throwable error )
98 {
99 logger.info( toString( content ), error );
100 }
101
102
103 public void info( Throwable error )
104 {
105 logger.info( "", error );
106 }
107
108
109 public void warn( CharSequence content )
110 {
111 logger.warn( toString( content ) );
112 }
113
114
115 public void warn( CharSequence content, Throwable error )
116 {
117 logger.warn( toString( content ), error );
118 }
119
120
121 public void warn( Throwable error )
122 {
123 logger.warn( "", error );
124 }
125
126
127 public void error( CharSequence content )
128 {
129 logger.error( toString( content ) );
130 }
131
132
133 public void error( CharSequence content, Throwable error )
134 {
135 logger.error( toString( content ), error );
136 }
137
138
139 public void error( Throwable error )
140 {
141 logger.error( "", error );
142 }
143
144
145 public boolean isDebugEnabled()
146 {
147 return logger.isDebugEnabled();
148 }
149
150
151 public boolean isInfoEnabled()
152 {
153 return logger.isInfoEnabled();
154 }
155
156
157 public boolean isWarnEnabled()
158 {
159 return logger.isWarnEnabled();
160 }
161
162
163 public boolean isErrorEnabled()
164 {
165 return logger.isErrorEnabled();
166 }
167
168
169
170
171
172 private String toString( CharSequence content )
173 {
174 if ( content == null )
175 {
176 return "";
177 }
178
179 return content.toString();
180 }
181 }