All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mentalog.Logger Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package org.mentalog;

import org.mentalog.interceptor.Interceptor;

/**
 * The log interface.
 * 
 * Refer to: http://mentalog.soliveirajr.com for documentations, recipes and more.
 * 
 * @author Sergio Oliveira Jr. - [email protected]
 */
public interface Logger extends VarargsOverloading, LogMessageBuilder, AsynchronousLogger {

	/**
	 * Is the log enabled, in other words, will a call to log() log anything? This method is useful if you don't want to process the log() method arguments. If you don't care, just call log and 
	 * if the log is not enabled it will not print anything.
	 * @return true if enabled
	 */
	public boolean isEnabled();

	/**
	 * Roll the log file. It appends -ddMMyyyy-HHmmss to the current log file and opens a new one.
	 */
	public void roll();

	/**
	 * Log as many objects as you want. The method toString() will be called for each object passed here unless you are using a string encoder for the object.
	 * 
	 * The objects are logged with a space (' ') between them.
	 * 
	 * @param obj The list of objects to log.
	 */
	public void log(Object... obj);
	
	/**
	 * Close this log. If this log is file-based, the file will be closed.
	 */
	public void close();

	/**
	 * Add a log interceptor, so you can intercept the bytebuffer that is about to be written by the log.
	 * 
	 * @param interceptor
	 *            The log interceptor
	 */
	public void addInterceptor(Interceptor interceptor);

	/**
	 * Remove a log interceptor.
	 * 
	 * @param interceptor
	 *            The log interceptor
	 */
	public void removeInterceptor(Interceptor interceptor);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy