Index: lutinutil/src/java/org/codelutin/log/LutinLog.java diff -u /dev/null lutinutil/src/java/org/codelutin/log/LutinLog.java:1.1 --- /dev/null Sat Sep 9 02:44:40 2006 +++ lutinutil/src/java/org/codelutin/log/LutinLog.java Sat Sep 9 02:44:35 2006 @@ -0,0 +1,190 @@ +/* *##% + * Copyright (C) 2006 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * LutinLog.java + * + * Created: 9 sept. 06 03:53:09 + * + * @author poussin + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2006/09/09 02:44:35 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.log; + +import org.apache.commons.logging.Log; + + +/** + * @author poussin + * + */ + +public class LutinLog implements Log { + + protected LutinLogFactory factory = null; + protected Log parent = null; + + protected LutinLog(LutinLogFactory factory, Log parent) { + this.factory = factory; + this.parent = parent; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#debug(java.lang.Object) + */ + public void debug(Object arg0) { + parent.debug(arg0); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#debug(java.lang.Object, java.lang.Throwable) + */ + public void debug(Object arg0, Throwable arg1) { + parent.debug(arg0, arg1); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#error(java.lang.Object) + */ + public void error(Object arg0) { + parent.error(arg0); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#error(java.lang.Object, java.lang.Throwable) + */ + public void error(Object arg0, Throwable arg1) { + parent.error(arg0, arg1); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#fatal(java.lang.Object) + */ + public void fatal(Object arg0) { + parent.fatal(arg0); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#fatal(java.lang.Object, java.lang.Throwable) + */ + public void fatal(Object arg0, Throwable arg1) { + parent.fatal(arg0, arg1); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#info(java.lang.Object) + */ + public void info(Object arg0) { + parent.info(arg0); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#info(java.lang.Object, java.lang.Throwable) + */ + public void info(Object arg0, Throwable arg1) { + parent.info(arg0, arg1); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#isDebugEnabled() + */ + public boolean isDebugEnabled() { + boolean result = parent.isDebugEnabled(); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#isErrorEnabled() + */ + public boolean isErrorEnabled() { + boolean result = parent.isErrorEnabled(); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#isFatalEnabled() + */ + public boolean isFatalEnabled() { + boolean result = parent.isFatalEnabled(); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#isInfoEnabled() + */ + public boolean isInfoEnabled() { + boolean result = parent.isInfoEnabled(); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#isTraceEnabled() + */ + public boolean isTraceEnabled() { + boolean result = parent.isTraceEnabled(); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#isWarnEnabled() + */ + public boolean isWarnEnabled() { + boolean result = parent.isWarnEnabled(); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#trace(java.lang.Object) + */ + public void trace(Object arg0) { + parent.trace(arg0); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#trace(java.lang.Object, java.lang.Throwable) + */ + public void trace(Object arg0, Throwable arg1) { + parent.trace(arg0, arg1); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#warn(java.lang.Object) + */ + public void warn(Object arg0) { + parent.warn(arg0); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.Log#warn(java.lang.Object, java.lang.Throwable) + */ + public void warn(Object arg0, Throwable arg1) { + parent.warn(arg0, arg1); + } + + protected void fireEvent(LutinLogEvent e) { + + } + +} + + Index: lutinutil/src/java/org/codelutin/log/LutinLogEvent.java diff -u /dev/null lutinutil/src/java/org/codelutin/log/LutinLogEvent.java:1.1 --- /dev/null Sat Sep 9 02:44:40 2006 +++ lutinutil/src/java/org/codelutin/log/LutinLogEvent.java Sat Sep 9 02:44:35 2006 @@ -0,0 +1,102 @@ +/* *##% + * Copyright (C) 2006 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * LutinLogEvent.java + * + * Created: 9 sept. 06 04:01:26 + * + * @author poussin + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2006/09/09 02:44:35 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.log; + +import java.util.EventObject; + + +/** + * @author poussin + * + */ + +public class LutinLogEvent extends EventObject { + + /** */ + private static final long serialVersionUID = 1L; + private Object type; + private LogType logType; + private String msg; + private Object eee; + + static enum ChangeType {log, min, max, value, askStop, start, end} + static enum LogType {user, trace, debug, info, warn, error, fatal} + + /** + * @param source + */ + public LutinLogEvent(Object source, ChangeType type, LogType logType, String msg, Throwable eee) { + super(source); + this.type = type; + this.logType = logType; + this.msg = msg; + this.eee = eee; + } + + /* (non-Javadoc) + * @see java.util.EventObject#getSource() + */ + public LutinLog getLutinLog() { + return (LutinLog)super.getSource(); + } + + /** + * @return the type + */ + public Object getType() { + return this.type; + } + + /** + * @return the logType + */ + public LogType getLogType() { + return this.logType; + } + + /** + * @return the msg + */ + public String getMsg() { + return this.msg; + } + + /** + * @return the eee + */ + public Object getThrowabl() { + return this.eee; + } + +} + + Index: lutinutil/src/java/org/codelutin/log/LutinLogFactory.java diff -u /dev/null lutinutil/src/java/org/codelutin/log/LutinLogFactory.java:1.1 --- /dev/null Sat Sep 9 02:44:40 2006 +++ lutinutil/src/java/org/codelutin/log/LutinLogFactory.java Sat Sep 9 02:44:35 2006 @@ -0,0 +1,124 @@ +/* *##% + * Copyright (C) 2006 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * LutinLogFactory.java + * + * Created: 9 sept. 06 03:45:29 + * + * @author poussin + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2006/09/09 02:44:35 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.log; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogConfigurationException; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.logging.impl.LogFactoryImpl; + + +/** + * @author poussin + * + */ + +public class LutinLogFactory extends LogFactory { + + protected LogFactory parentFactory = null; + + + /** + * @return the parentFactory + */ + protected LogFactory getParentFactory() { + if (this.parentFactory == null) { + this.parentFactory = new LogFactoryImpl(); + } + return this.parentFactory; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.LogFactory#getAttribute(java.lang.String) + */ + @Override + public Object getAttribute(String arg0) { + Object result = getParentFactory().getAttribute(arg0); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.LogFactory#getAttributeNames() + */ + @Override + public String[] getAttributeNames() { + String[] result = getParentFactory().getAttributeNames(); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.LogFactory#getInstance(java.lang.Class) + */ + @Override + public Log getInstance(Class arg0) throws LogConfigurationException { + Log log = getParentFactory().getInstance(arg0); + Log result = new LutinLog(this, log); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.LogFactory#getInstance(java.lang.String) + */ + @Override + public Log getInstance(String arg0) throws LogConfigurationException { + Log log = getParentFactory().getInstance(arg0); + Log result = new LutinLog(this, log); + return result; + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.LogFactory#release() + */ + @Override + public void release() { + getParentFactory().release(); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.LogFactory#removeAttribute(java.lang.String) + */ + @Override + public void removeAttribute(String arg0) { + getParentFactory().removeAttribute(arg0); + } + + /* (non-Javadoc) + * @see org.apache.commons.logging.LogFactory#setAttribute(java.lang.String, java.lang.Object) + */ + @Override + public void setAttribute(String arg0, Object arg1) { + getParentFactory().setAttribute(arg0, arg1); + } + +} + +