package com.ozacc.mail.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.log.LogSystem;

/**
 * VelocityのログメッセージをCommonsLoggingを通して出力させるクラス。
 * 
 * 
 * @see XMLVelocityMailBuilderImpl
 * @see JDomXMLMailBuilder
 * 
 * @since 1.0.3
 * 
 * @author Tomohiro Otsuka
 * @version $Id: VelocityLogSystem.java,v 1.2.2.1 2004/11/25 08:01:07 otsuka Exp $
 */
public class VelocityLogSystem implements LogSystem {

	private static Log log = LogFactory.getLog(Velocity.class);

	/**
	 * @see org.apache.velocity.runtime.log.LogSystem#init(org.apache.velocity.runtime.RuntimeServices)
	 */
	public void init(RuntimeServices rsvc) throws Exception {
	// do nothing
	}

	/**
	 * @see org.apache.velocity.runtime.log.LogSystem#logVelocityMessage(int, java.lang.String)
	 */
	public void logVelocityMessage(int level, String message) {
		switch (level) {
			case DEBUG_ID:
				log.debug(message);
				break;
			case INFO_ID:
				log.info(message);
				break;
			case WARN_ID:
				log.warn(message);
				break;
			case ERROR_ID:
				log.error(message);
				break;
		}
	}

}