KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > util > MuleLogger


1 /*
2  * $Id: MuleLogger.java 3196 2006-09-24 22:50:50Z holger $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.util;
12
13 import java.util.Arrays JavaDoc;
14 import java.util.List JavaDoc;
15
16 import org.apache.commons.logging.Log;
17
18 /**
19  * A {@link Log} wrapper that supports boilerplate logging for high impact messages
20  */

21 // @Immutable
22
public class MuleLogger implements Log
23 {
24     private final Log logger;
25
26     public MuleLogger(Log logger)
27     {
28         if (logger == null)
29         {
30             throw new NullPointerException JavaDoc("logger");
31         }
32
33         this.logger = logger;
34     }
35
36     public boolean isDebugEnabled()
37     {
38         return logger.isDebugEnabled();
39     }
40
41     public boolean isErrorEnabled()
42     {
43         return logger.isErrorEnabled();
44     }
45
46     public boolean isFatalEnabled()
47     {
48         return logger.isFatalEnabled();
49     }
50
51     public boolean isInfoEnabled()
52     {
53         return logger.isInfoEnabled();
54     }
55
56     public boolean isTraceEnabled()
57     {
58         return logger.isTraceEnabled();
59     }
60
61     public boolean isWarnEnabled()
62     {
63         return logger.isWarnEnabled();
64     }
65
66     public void trace(Object JavaDoc o)
67     {
68         logger.trace(o);
69     }
70
71     public void trace(Object JavaDoc o, Throwable JavaDoc throwable)
72     {
73         logger.trace(o, throwable);
74     }
75
76     public void debug(Object JavaDoc o)
77     {
78         logger.debug(o);
79     }
80
81     public void debug(Object JavaDoc o, Throwable JavaDoc throwable)
82     {
83         logger.debug(o, throwable);
84     }
85
86     public void info(Object JavaDoc o)
87     {
88         logger.info(o);
89     }
90
91     public void info(Object JavaDoc o, Throwable JavaDoc throwable)
92     {
93         logger.info(o, throwable);
94     }
95
96     public void warn(Object JavaDoc o)
97     {
98         logger.warn(o);
99     }
100
101     public void warn(Object JavaDoc o, Throwable JavaDoc throwable)
102     {
103         logger.warn(o, throwable);
104     }
105
106     public void error(Object JavaDoc o)
107     {
108         logger.error(o);
109     }
110
111     public void error(Object JavaDoc o, Throwable JavaDoc throwable)
112     {
113         logger.error(o, throwable);
114     }
115
116     public void fatal(Object JavaDoc o)
117     {
118         logger.fatal(o);
119     }
120
121     public void fatal(Object JavaDoc o, Throwable JavaDoc throwable)
122     {
123         logger.fatal(o, throwable);
124     }
125
126     public void boilerPlate(String JavaDoc message)
127     {
128         boilerPlate(message, '*', 80);
129     }
130
131     public void logBoilerPlate(List JavaDoc messages)
132     {
133         boilerPlate(messages, '*', 80);
134     }
135
136     public void logBoilerPlate(String JavaDoc[] messages)
137     {
138         boilerPlate(Arrays.asList(messages), '*', 80);
139     }
140
141     public void boilerPlate(String JavaDoc message, char c, int maxlength)
142     {
143         if (logger.isInfoEnabled())
144         {
145             logger.info("\n" + StringMessageUtils.getBoilerPlate(message, c, maxlength));
146         }
147     }
148
149     public void boilerPlate(List JavaDoc messages, char c, int maxlength)
150     {
151         if (logger.isInfoEnabled())
152         {
153             logger.info("\n" + StringMessageUtils.getBoilerPlate(messages, c, maxlength));
154         }
155     }
156
157     public void boilerPlate(String JavaDoc[] messages, char c, int maxlength)
158     {
159         boilerPlate(Arrays.asList(messages), c, maxlength);
160     }
161
162 }
163
Popular Tags