//----------------------------BEGIN LICENSE----------------------------
/* 
 * Willow : the Open Source WorkFlow Project
 * Distributable under GNU LGPL license by gun.org
 *
 * Copyright (C) 2004-2010  huihoo.org 
 * Copyright (C) 2004-2010  ZosaTapo <dertyang@hotmail.com> 
 * 
 * ====================================================================
 * Project Homepage : http://www.huihoo.org/willow
 * Source Forge     : http://sourceforge.net/projects/huihoo
 * Mailing list     : willow@lists.sourceforge.net 
 */
//----------------------------END  LICENSE-----------------------------
package org.huihoo.willow;
import java.beans.PropertyChangeListener;

/**
 * A <b>Logger</b> is a generic interface for the message and exception
 * logging methods of the WorkflowContext interface.  Loggers can be
 * attached at any Container level, but will typically only be attached
 * to a Container, or higher level, Container.
 *
 */
public interface Logger
{
	// ----------------------------------------------------- Manifest TypeConstants
	/**
	 * Verbosity level constants for log messages that may be filtered
	 * by the underlying logger.
	 */
	public static final int FATAL = Integer.MIN_VALUE;
	public static final int ERROR = 1;
	public static final int WARNING = 2;
	public static final int INFORMATION = 3;
	public static final int DEBUG = 4;
	// ------------------------------------------------------------- Properties
	/**
	 * Return the Container with which this Logger has been associated.
	 */
	public Container getContainer();
	/**
	 * Set the Container with which this Logger has been associated.
	 *
	 * @param container The associated Container
	 */
	public void setContainer(Container container);
	
	
	/**
	 * Return descriptive information about this Logger implementation and
	 * the corresponding version number, in the format
	 * <code>&lt;description&gt;/&lt;version&gt;</code>.
	 */
	public String getInfo();
	
	/**
	 * Return the verbosity level of this logger.  Messages logged with a
	 * higher verbosity than this level will be silently ignored.
	 */
	public int getVerbosity();
	/**
	 * Set the verbosity level of this logger.  Messages logged with a
	 * higher verbosity than this level will be silently ignored.
	 *
	 * @param verbosity The new verbosity level
	 */
	public void setVerbosity(int verbosity);
	
	// --------------------------------------------------------- Public Methods
	/**
	 * Writes the specified message to a servlet log file, usually an event
	 * log.  The name and type of the servlet log is specific to the
	 * servlet container.  This message will be logged unconditionally.
	 *
	 * @param message A <code>String</code> specifying the message to be
	 *  written to the log file
	 */
	public void log(String message);

	/**
	 * Writes an explanatory message and a stack trace for a given
	 * <code>Throwable</code> exception to the servlet log file.  The name
	 * and type of the servlet log file is specific to the servlet container,
	 * usually an event log.  This message will be logged unconditionally.
	 *
	 * @param message A <code>String</code> that describes the error or
	 *  exception
	 * @param throwable The <code>Throwable</code> error or exception
	 */
	public void log(String message, Throwable throwable);
	/**
	 * Writes the specified message to the servlet log file, usually an event
	 * log, if the logger is set to a verbosity level equal to or higher than
	 * the specified value for this message.
	 *
	 * @param message A <code>String</code> specifying the message to be
	 *  written to the log file
	 * @param verbosity Verbosity level of this message
	 */
	public void log(String message, int verbosity);
	/**
	 * Writes the specified message and exception to the servlet log file,
	 * usually an event log, if the logger is set to a verbosity level equal
	 * to or higher than the specified value for this message.
	 *
	 * @param message A <code>String</code> that describes the error or
	 *  exception
	 * @param throwable The <code>Throwable</code> error or exception
	 * @param verbosity Verbosity level of this message
	 */
	public void log(String message, Throwable throwable, int verbosity);


	/**
	 * Add a property change listener to this component.
	 *
	 * @param listener The listener to add
	 */
	public void addPropertyChangeListener(PropertyChangeListener listener);

	/**
	 * Remove a property change listener from this component.
	 *
	 * @param listener The listener to remove
	 */
	public void removePropertyChangeListener(PropertyChangeListener listener);
}
