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 import org.apache.commons.logging.Log; 018 import org.apache.commons.logging.LogFactory; 019 020 /** 021 * Commons Logging Wrapper 022 * @author Sebastian Thomschke 023 */ 024 public class LoggerJCLImpl implements Logger 025 { 026 private final Log jclLoggger; 027 028 /** 029 * @param name the name of the logger 030 * @throws IllegalArgumentException if <code>name == null</code> 031 */ 032 public LoggerJCLImpl(final String name) throws IllegalArgumentException 033 { 034 Assert.argumentNotNull("name", name); 035 036 jclLoggger = LogFactory.getLog(name); 037 } 038 039 /** 040 * {@inheritDoc} 041 */ 042 public void debug(final String msg) 043 { 044 jclLoggger.debug(msg); 045 } 046 047 /** 048 * {@inheritDoc} 049 */ 050 public void debug(final String msg, final Throwable t) 051 { 052 jclLoggger.debug(msg, t); 053 } 054 055 /** 056 * {@inheritDoc} 057 */ 058 public void error(final String msg) 059 { 060 jclLoggger.error(msg); 061 } 062 063 /** 064 * {@inheritDoc} 065 */ 066 public void error(final String msg, final Throwable t) 067 { 068 jclLoggger.error(msg, t); 069 } 070 071 /** 072 * {@inheritDoc} 073 */ 074 public void info(final String msg) 075 { 076 jclLoggger.info(msg); 077 } 078 079 /** 080 * {@inheritDoc} 081 */ 082 public void info(final String msg, final Throwable t) 083 { 084 jclLoggger.info(msg, t); 085 } 086 087 /** 088 * {@inheritDoc} 089 */ 090 public boolean isDebug() 091 { 092 return jclLoggger.isDebugEnabled(); 093 } 094 095 /** 096 * {@inheritDoc} 097 */ 098 public boolean isError() 099 { 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 }