1 |
// Jericho HTML Parser - Java based library for analysing and manipulating HTML
|
2 |
// Version 3.2
|
3 |
// Copyright (C) 2004-2009 Martin Jericho
|
4 |
// http://jericho.htmlparser.net/
|
5 |
//
|
6 |
// This library is free software; you can redistribute it and/or
|
7 |
// modify it under the terms of either one of the following licences:
|
8 |
//
|
9 |
// 1. The Eclipse Public License (EPL) version 1.0,
|
10 |
// included in this distribution in the file licence-epl-1.0.html
|
11 |
// or available at http://www.eclipse.org/legal/epl-v10.html
|
12 |
//
|
13 |
// 2. The GNU Lesser General Public License (LGPL) version 2.1 or later,
|
14 |
// included in this distribution in the file licence-lgpl-2.1.txt
|
15 |
// or available at http://www.gnu.org/licenses/lgpl.txt
|
16 |
//
|
17 |
// This library is distributed on an "AS IS" basis,
|
18 |
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
19 |
// See the individual licence texts for more details.
|
20 |
|
21 |
package net.htmlparser.jericho;
|
22 |
|
23 |
/**
|
24 |
* Defines the interface for a factory class to provide {@link Logger} instances for each {@link Source} object.
|
25 |
* <p>
|
26 |
* It is not usually necessary for users to create implementations of this interface, as
|
27 |
* several predefined instances are defined which provide the most commonly required {@link Logger} implementations.
|
28 |
* <p>
|
29 |
* By default, a <code>LoggerProvider</code> is chosen automatically according to the algorithm described in the static {@link Config#LoggerProvider} property.
|
30 |
* This automatic choice can be overridden by setting the {@link Config#LoggerProvider} property manually with an instance of this interface,
|
31 |
* but this is also usually not necessary.
|
32 |
*/
|
33 |
public interface LoggerProvider {
|
34 |
/**
|
35 |
* A {@link LoggerProvider} implementation that disables all log messages.
|
36 |
*/
|
37 |
public static final LoggerProvider DISABLED=LoggerProviderDisabled.INSTANCE;
|
38 |
|
39 |
/**
|
40 |
* A {@link LoggerProvider} implementation that sends all log messages to the standard error output stream (<code>System.err</code>).
|
41 |
* <p>
|
42 |
* The implementation uses the following code to create each logger:<br />
|
43 |
* <code>new </code>{@link WriterLogger}<code>(new OutputStreamWriter(System.err),name)</code>
|
44 |
*/
|
45 |
public static final LoggerProvider STDERR=LoggerProviderSTDERR.INSTANCE;
|
46 |
|
47 |
/**
|
48 |
* A {@link LoggerProvider} implementation that wraps the standard <code>java.util.logging</code> system included in the Java SDK version 1.4 and above.
|
49 |
* <p>
|
50 |
* 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.
|
51 |
* <p>
|
52 |
* The following mapping of <a href="Logger.html#LoggingLevel">logging levels</a> is used:
|
53 |
* <table class="bordered" style="margin: 15px" cellspacing="0">
|
54 |
* <tr><th>{@link Logger} level<th><code>java.util.logging.Level</code>
|
55 |
* <tr><td>{@link Logger#error(String) ERROR}<td><code>SEVERE</code>
|
56 |
* <tr><td>{@link Logger#warn(String) WARN}<td><code>WARNING</code>
|
57 |
* <tr><td>{@link Logger#info(String) INFO}<td><code>INFO</code>
|
58 |
* <tr><td>{@link Logger#debug(String) DEBUG}<td><code>FINE</code>
|
59 |
* </table>
|
60 |
*/
|
61 |
public static final LoggerProvider JAVA=LoggerProviderJava.INSTANCE;
|
62 |
|
63 |
/**
|
64 |
* A {@link LoggerProvider} implementation that wraps the <a target="_blank" href="http://jakarta.apache.org/commons/logging/">Jakarta Commons Logging</a> (JCL) framework.
|
65 |
* <p>
|
66 |
* See the description of the static {@link Config#LoggerProvider} property for details on when this implementation is used as the default.
|
67 |
* <p>
|
68 |
* The following mapping of <a href="Logger.html#LoggingLevel">logging levels</a> is used:
|
69 |
* <table class="bordered" style="margin: 15px" cellspacing="0">
|
70 |
* <tr><th>{@link Logger} level<th><code>org.apache.commons.logging</code> level
|
71 |
* <tr><td>{@link Logger#error(String) ERROR}<td><code>error</code>
|
72 |
* <tr><td>{@link Logger#warn(String) WARN}<td><code>warn</code>
|
73 |
* <tr><td>{@link Logger#info(String) INFO}<td><code>info</code>
|
74 |
* <tr><td>{@link Logger#debug(String) DEBUG}<td><code>debug</code>
|
75 |
* </table>
|
76 |
*/
|
77 |
public static final LoggerProvider JCL=LoggerProviderJCL.INSTANCE;
|
78 |
|
79 |
/**
|
80 |
* A {@link LoggerProvider} implementation that wraps the <a target="_blank" href="http://logging.apache.org/log4j/">Apache Log4J</a> framework.
|
81 |
* <p>
|
82 |
* See the description of the static {@link Config#LoggerProvider} property for details on when this implementation is used as the default.
|
83 |
* <p>
|
84 |
* The following mapping of <a href="Logger.html#LoggingLevel">logging levels</a> is used:
|
85 |
* <table class="bordered" style="margin: 15px" cellspacing="0">
|
86 |
* <tr><th>{@link Logger} level<th><code>org.apache.log4j.Level</code>
|
87 |
* <tr><td>{@link Logger#error(String) ERROR}<td><code>ERROR</code>
|
88 |
* <tr><td>{@link Logger#warn(String) WARN}<td><code>WARN</code>
|
89 |
* <tr><td>{@link Logger#info(String) INFO}<td><code>INFO</code>
|
90 |
* <tr><td>{@link Logger#debug(String) DEBUG}<td><code>DEBUG</code>
|
91 |
* </table>
|
92 |
*/
|
93 |
public static final LoggerProvider LOG4J=LoggerProviderLog4J.INSTANCE;
|
94 |
|
95 |
/**
|
96 |
* A {@link LoggerProvider} implementation that wraps the <a target="_blank" href="http://www.slf4j.org/">SLF4J</a> framework.
|
97 |
* <p>
|
98 |
* See the description of the static {@link Config#LoggerProvider} property for details on when this implementation is used as the default.
|
99 |
* <p>
|
100 |
* The following mapping of <a href="Logger.html#LoggingLevel">logging levels</a> is used:
|
101 |
* <table class="bordered" style="margin: 15px" cellspacing="0">
|
102 |
* <tr><th>{@link Logger} level<th><code>org.slf4j.Logger</code> level
|
103 |
* <tr><td>{@link Logger#error(String) ERROR}<td><code>error</code>
|
104 |
* <tr><td>{@link Logger#warn(String) WARN}<td><code>warn</code>
|
105 |
* <tr><td>{@link Logger#info(String) INFO}<td><code>info</code>
|
106 |
* <tr><td>{@link Logger#debug(String) DEBUG}<td><code>debug</code>
|
107 |
* </table>
|
108 |
*/
|
109 |
public static final LoggerProvider SLF4J=LoggerProviderSLF4J.INSTANCE;
|
110 |
|
111 |
/**
|
112 |
* Creates a new {@link Logger} instance with the specified name.
|
113 |
* <p>
|
114 |
* The <code>name</code> argument is used by the underlying logging implementation, and is normally a dot-separated name based on
|
115 |
* the package name or class name of the subsystem.
|
116 |
* <p>
|
117 |
* The name used for all automatically created {@link Logger} instances is "<code>net.htmlparser.jericho</code>".
|
118 |
*
|
119 |
* @param name the name of the logger, the use of which is determined by the underlying logging implementation, may be <code>null</code>.
|
120 |
* @return a new {@link Logger} instance with the specified name.
|
121 |
*/
|
122 |
public Logger getLogger(String name);
|
123 |
}
|