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  /**
18   * SLF4J Wrapper
19   * @author Sebastian Thomschke
20   */
21  public class LoggerSLF4JImpl implements Logger
22  {
23  	private final org.slf4j.Logger slf4jLogger;
24  
25  	/**
26  	 * @param name the name of the logger
27  	 * @throws IllegalArgumentException if <code>name == null</code>
28  	 */
29  	public LoggerSLF4JImpl(final String name) throws IllegalArgumentException
30  	{
31  		Assert.argumentNotNull("name", name);
32  		slf4jLogger = org.slf4j.LoggerFactory.getLogger(name);
33  	}
34  
35  	/**
36  	 * {@inheritDoc}
37  	 */
38  	public void debug(final String msg)
39  	{
40  		slf4jLogger.debug(msg);
41  	}
42  
43  	/**
44  	 * {@inheritDoc}
45  	 */
46  	public void debug(final String msg, final Throwable t)
47  	{
48  		slf4jLogger.debug(msg, t);
49  	}
50  
51  	/**
52  	 * {@inheritDoc}
53  	 */
54  	public void error(final String msg)
55  	{
56  		slf4jLogger.error(msg);
57  	}
58  
59  	/**
60  	 * {@inheritDoc}
61  	 */
62  	public void error(final String msg, final Throwable t)
63  	{
64  		slf4jLogger.error(msg, t);
65  	}
66  
67  	/**
68  	 * {@inheritDoc}
69  	 */
70  	public void info(final String msg)
71  	{
72  		slf4jLogger.info(msg);
73  	}
74  
75  	/**
76  	 * {@inheritDoc}
77  	 */
78  	public void info(final String msg, final Throwable t)
79  	{
80  		slf4jLogger.info(msg, t);
81  	}
82  
83  	/**
84  	 * {@inheritDoc}
85  	 */
86  	public boolean isDebug()
87  	{
88  		return slf4jLogger.isDebugEnabled();
89  	}
90  
91  	/**
92  	 * {@inheritDoc}
93  	 */
94  	public boolean isError()
95  	{
96  		return slf4jLogger.isErrorEnabled();
97  	}
98  
99  	/**
100 	 * {@inheritDoc}
101 	 */
102 	public boolean isInfo()
103 	{
104 		return slf4jLogger.isInfoEnabled();
105 	}
106 
107 	/**
108 	 * {@inheritDoc}
109 	 */
110 	public boolean isTrace()
111 	{
112 		return slf4jLogger.isTraceEnabled();
113 	}
114 
115 	/**
116 	 * {@inheritDoc}
117 	 */
118 	public boolean isWarn()
119 	{
120 		return slf4jLogger.isWarnEnabled();
121 	}
122 
123 	/**
124 	 * {@inheritDoc}
125 	 */
126 	public void trace(final String msg)
127 	{
128 		slf4jLogger.trace(msg);
129 	}
130 
131 	/**
132 	 * {@inheritDoc}
133 	 */
134 	public void trace(final String msg, final Throwable t)
135 	{
136 		slf4jLogger.trace(msg, t);
137 	}
138 
139 	/**
140 	 * {@inheritDoc}
141 	 */
142 	public void warn(final String msg)
143 	{
144 		slf4jLogger.warn(msg);
145 	}
146 
147 	/**
148 	 * {@inheritDoc}
149 	 */
150 	public void warn(final String msg, final Throwable t)
151 	{
152 		slf4jLogger.warn(msg, t);
153 	}
154 }