001    /*******************************************************************************
002     * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
003     * Thomschke.
004     * 
005     * All Rights Reserved. This program and the accompanying materials
006     * are made available under the terms of the Eclipse Public License v1.0
007     * which accompanies this distribution, and is available at
008     * http://www.eclipse.org/legal/epl-v10.html
009     * 
010     * Contributors:
011     *     Sebastian Thomschke - initial implementation.
012     *******************************************************************************/
013    package net.sf.oval.logging;
014    
015    import net.sf.oval.internal.util.Assert;
016    
017    /**
018     * SLF4J Wrapper
019     * @author Sebastian Thomschke
020     */
021    public class LoggerSLF4JImpl implements Logger
022    {
023            private final org.slf4j.Logger slf4jLogger;
024    
025            /**
026             * @param name the name of the logger
027             * @throws IllegalArgumentException if <code>name == null</code>
028             */
029            public LoggerSLF4JImpl(final String name) throws IllegalArgumentException
030            {
031                    Assert.argumentNotNull("name", name);
032                    slf4jLogger = org.slf4j.LoggerFactory.getLogger(name);
033            }
034    
035            /**
036             * {@inheritDoc}
037             */
038            public void debug(final String msg)
039            {
040                    slf4jLogger.debug(msg);
041            }
042    
043            /**
044             * {@inheritDoc}
045             */
046            public void debug(final String msg, final Throwable t)
047            {
048                    slf4jLogger.debug(msg, t);
049            }
050    
051            /**
052             * {@inheritDoc}
053             */
054            public void error(final String msg)
055            {
056                    slf4jLogger.error(msg);
057            }
058    
059            /**
060             * {@inheritDoc}
061             */
062            public void error(final String msg, final Throwable t)
063            {
064                    slf4jLogger.error(msg, t);
065            }
066    
067            /**
068             * {@inheritDoc}
069             */
070            public void info(final String msg)
071            {
072                    slf4jLogger.info(msg);
073            }
074    
075            /**
076             * {@inheritDoc}
077             */
078            public void info(final String msg, final Throwable t)
079            {
080                    slf4jLogger.info(msg, t);
081            }
082    
083            /**
084             * {@inheritDoc}
085             */
086            public boolean isDebug()
087            {
088                    return slf4jLogger.isDebugEnabled();
089            }
090    
091            /**
092             * {@inheritDoc}
093             */
094            public boolean isError()
095            {
096                    return slf4jLogger.isErrorEnabled();
097            }
098    
099            /**
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    }