au.id.jericho.lib.html.LoggerProvider Maven / Gradle / Ivy
// Jericho HTML Parser - Java based library for analysing and manipulating HTML
// Version 2.4
// Copyright (C) 2007 Martin Jericho
// http://jerichohtml.sourceforge.net/
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of either one of the following licences:
//
// 1. The Eclipse Public License (EPL) version 1.0,
// included in this distribution in the file licence-epl-1.0.html
// or available at http://www.eclipse.org/legal/epl-v10.html
//
// 2. The GNU Lesser General Public License (LGPL) version 2.1 or later,
// included in this distribution in the file licence-lgpl-2.1.txt
// or available at http://www.gnu.org/licenses/lgpl.txt
//
// This library is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
// See the individual licence texts for more details.
package au.id.jericho.lib.html;
/**
* Defines the interface for a factory class to provide {@link Logger} instances for each {@link Source} object.
*
* It is not usually necessary for users to create implementations of this interface, as
* several predefined instances are defined which provide the most commonly required {@link Logger} implementations.
*
* By default, a LoggerProvider
is chosen automatically according to the algorithm described in the static {@link Config#LoggerProvider} property.
* This automatic choice can be overridden by setting the {@link Config#LoggerProvider} property manually with an instance of this interface,
* but this is also usually not necessary.
*/
public interface LoggerProvider {
/**
* A {@link LoggerProvider} implementation that disables all log messages.
*/
public static final LoggerProvider DISABLED=LoggerProviderDisabled.INSTANCE;
/**
* A {@link LoggerProvider} implementation that sends all log messages to the standard error output stream (System.err
).
*
* The implementation uses the following code to create each logger:
* new
{@link WriterLogger}(new OutputStreamWriter(System.err),name)
*/
public static final LoggerProvider STDERR=LoggerProviderSTDERR.INSTANCE;
/**
* A {@link LoggerProvider} implementation that wraps the standard java.util.logging
system included in the Java SDK version 1.4 and above.
*
* This is the default used if no other logging framework is detected. See the description of the static {@link Config#LoggerProvider} property for more details.
*
* The following mapping of logging levels is used:
*
* {@link Logger} level java.util.logging.Level
* {@link Logger#error(String) ERROR} SEVERE
* {@link Logger#warn(String) WARN} WARNING
* {@link Logger#info(String) INFO} INFO
* {@link Logger#debug(String) DEBUG} FINE
*
*/
public static final LoggerProvider JAVA=LoggerProviderJava.INSTANCE;
/**
* A {@link LoggerProvider} implementation that wraps the Jakarta Commons Logging (JCL) framework.
*
* See the description of the static {@link Config#LoggerProvider} property for details on when this implementation is used as the default.
*
* The following mapping of logging levels is used:
*
* {@link Logger} level org.apache.commons.logging
level
* {@link Logger#error(String) ERROR} error
* {@link Logger#warn(String) WARN} warn
* {@link Logger#info(String) INFO} info
* {@link Logger#debug(String) DEBUG} debug
*
*/
public static final LoggerProvider JCL=LoggerProviderJCL.INSTANCE;
/**
* A {@link LoggerProvider} implementation that wraps the Apache Log4J framework.
*
* See the description of the static {@link Config#LoggerProvider} property for details on when this implementation is used as the default.
*
* The following mapping of logging levels is used:
*
* {@link Logger} level org.apache.log4j.Level
* {@link Logger#error(String) ERROR} ERROR
* {@link Logger#warn(String) WARN} WARN
* {@link Logger#info(String) INFO} INFO
* {@link Logger#debug(String) DEBUG} DEBUG
*
*/
public static final LoggerProvider LOG4J=LoggerProviderLog4J.INSTANCE;
/**
* A {@link LoggerProvider} implementation that wraps the SLF4J framework.
*
* See the description of the static {@link Config#LoggerProvider} property for details on when this implementation is used as the default.
*
* The following mapping of logging levels is used:
*
* {@link Logger} level org.slf4j.Logger
level
* {@link Logger#error(String) ERROR} error
* {@link Logger#warn(String) WARN} warn
* {@link Logger#info(String) INFO} info
* {@link Logger#debug(String) DEBUG} debug
*
*/
public static final LoggerProvider SLF4J=LoggerProviderSLF4J.INSTANCE;
/**
* Creates a new {@link Logger} instance with the specified name.
*
* The name
argument is used by the underlying logging implementation, and is normally a dot-separated name based on
* the package name or class name of the subsystem.
*
* The name used for all automatically created {@link Logger} instances is "net.htmlparser.jericho
".
*
* @param name the name of the logger, the use of which is determined by the underlying logging implementation, may be null
.
* @return a new {@link Logger} instance with the specified name.
*/
Logger getLogger(String name);
}