/*
 * Created on 2004-2-29
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
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 ScriptContext interface.  Loggers can be
 * attached at any Container level, but will typically only be attached
 * to a Container, or higher level, Container.
 *
 * @author zosatapo
 */
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
	/**
	 * Add a property change listener to this component.
	 *
	 * @param listener The listener to add
	 */
	public void addPropertyChangeListener(PropertyChangeListener listener);
	/**
	 * 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);
	/**
	 * Remove a property change listener from this component.
	 *
	 * @param listener The listener to remove
	 */
	public void removePropertyChangeListener(PropertyChangeListener listener);
}
