View Javadoc
1   /*******************************************************************************
2    * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
3    * Thomschke.
4    * 
5    * All Rights Reserved. This program and the accompanying materials
6    * are made available under the terms of the Eclipse Public License v1.0
7    * which accompanies this distribution, and is available at
8    * http://www.eclipse.org/legal/epl-v10.html
9    * 
10   * Contributors:
11   *     Sebastian Thomschke - initial implementation.
12   *******************************************************************************/
13  package net.sf.oval.logging;
14  
15  import net.sf.oval.internal.util.Assert;
16  
17  import org.apache.commons.logging.Log;
18  import org.apache.commons.logging.LogFactory;
19  
20  /**
21   * Commons Logging Wrapper
22   * @author Sebastian Thomschke
23   */
24  public class LoggerJCLImpl implements Logger
25  {
26  	private final Log jclLoggger;
27  
28  	/**
29  	 * @param name the name of the logger
30  	 * @throws IllegalArgumentException if <code>name == null</code>
31  	 */
32  	public LoggerJCLImpl(final String name) throws IllegalArgumentException
33  	{
34  		Assert.argumentNotNull("name", name);
35  
36  		jclLoggger = LogFactory.getLog(name);
37  	}
38  
39  	/**
40  	 * {@inheritDoc}
41  	 */
42  	public void debug(final String msg)
43  	{
44  		jclLoggger.debug(msg);
45  	}
46  
47  	/**
48  	 * {@inheritDoc}
49  	 */
50  	public void debug(final String msg, final Throwable t)
51  	{
52  		jclLoggger.debug(msg, t);
53  	}
54  
55  	/**
56  	 * {@inheritDoc}
57  	 */
58  	public void error(final String msg)
59  	{
60  		jclLoggger.error(msg);
61  	}
62  
63  	/**
64  	 * {@inheritDoc}
65  	 */
66  	public void error(final String msg, final Throwable t)
67  	{
68  		jclLoggger.error(msg, t);
69  	}
70  
71  	/**
72  	 * {@inheritDoc}
73  	 */
74  	public void info(final String msg)
75  	{
76  		jclLoggger.info(msg);
77  	}
78  
79  	/**
80  	 * {@inheritDoc}
81  	 */
82  	public void info(final String msg, final Throwable t)
83  	{
84  		jclLoggger.info(msg, t);
85  	}
86  
87  	/**
88  	 * {@inheritDoc}
89  	 */
90  	public boolean isDebug()
91  	{
92  		return jclLoggger.isDebugEnabled();
93  	}
94  
95  	/**
96  	 * {@inheritDoc}
97  	 */
98  	public boolean isError()
99  	{
100 		return jclLoggger.isErrorEnabled();
101 	}
102 
103 	/**
104 	 * {@inheritDoc}
105 	 */
106 	public boolean isInfo()
107 	{
108 		return jclLoggger.isInfoEnabled();
109 	}
110 
111 	/**
112 	 * {@inheritDoc}
113 	 */
114 	public boolean isTrace()
115 	{
116 		return jclLoggger.isTraceEnabled();
117 	}
118 
119 	/**
120 	 * {@inheritDoc}
121 	 */
122 	public boolean isWarn()
123 	{
124 		return jclLoggger.isWarnEnabled();
125 	}
126 
127 	/**
128 	 * {@inheritDoc}
129 	 */
130 	public void trace(final String msg)
131 	{
132 		jclLoggger.trace(msg);
133 	}
134 
135 	/**
136 	 * {@inheritDoc}
137 	 */
138 	public void trace(final String msg, final Throwable t)
139 	{
140 		jclLoggger.trace(msg, t);
141 	}
142 
143 	/**
144 	 * {@inheritDoc}
145 	 */
146 	public void warn(final String msg)
147 	{
148 		jclLoggger.warn(msg);
149 	}
150 
151 	/**
152 	 * {@inheritDoc}
153 	 */
154 	public void warn(final String msg, final Throwable t)
155 	{
156 		jclLoggger.warn(msg, t);
157 	}
158 }