Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.htmlparser.jericho
Class WriterLogger

    java.lang.Object
      WriterLogger

All Implemented Interfaces:
  Logger

    public class WriterLogger

extends java.lang.Object
implements Logger

Provides an implementation of the `Logger` interface that sends output to the specified `java.io.Writer`.

Each log entry is formatted using the `BasicLogFormatter.format(String level, String message, String loggerName)` method.

Note that each logging level can be enabled independently in this implementation. All levels are enabled by default.

Constructor Summary
`WriterLogger(java.io.Writer writer)` Constructs a new `WriterLogger` with the specified `Writer` and the default name.
`WriterLogger(java.io.Writer writer, java.lang.String name)` Constructs a new `WriterLogger` with the specified `Writer` and name.

Method Summary
`void` | `debug(java.lang.String message)` Logs a message at the DEBUG level.
`void` | `error(java.lang.String message)` Logs a message at the ERROR level.
`java.lang.String` | `getName()` Returns the name of this logger.
`java.io.Writer` | `getWriter()` Returns the `Writer` to which all output is sent.
`void` | `info(java.lang.String message)` Logs a message at the INFO level.
`boolean` | `isDebugEnabled()` Indicates whether logging is enabled at the DEBUG level.
`boolean` | `isErrorEnabled()` Indicates whether logging is enabled at the ERROR level.
`boolean` | `isInfoEnabled()` Indicates whether logging is enabled at the INFO level.
`boolean` | `isWarnEnabled()` Indicates whether logging is enabled at the WARN level.
`protected void` | `log(java.lang.String level, java.lang.String message)` Logs the specified message at the specified level.
`void` | `setDebugEnabled(boolean debugEnabled)` Sets whether logging is enabled at the DEBUG level.
`void` | `setErrorEnabled(boolean errorEnabled)` Sets whether logging is enabled at the ERROR level.
`void` | `setInfoEnabled(boolean infoEnabled)` Sets whether logging is enabled at the INFO level.
`void` | `setWarnEnabled(boolean warnEnabled)` Sets whether logging is enabled at the WARN level.
`void` | `warn(java.lang.String message)` Logs a message at the WARN level.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WriterLogger

    public WriterLogger(java.io.Writer writer)

  Constructs a new `WriterLogger` with the specified `Writer` and the default name.

  The default logger name is "`net.htmlparser.jericho`".

  Parameters:
    `writer` - the `Writer` to which all output is sent.

### WriterLogger

    public WriterLogger(java.io.Writer writer,
                        java.lang.String name)

  Constructs a new `WriterLogger` with the specified `Writer` and name.

  The value of the `name` argument is only relevant if the `BasicLogFormatter.OutputName` static property is set to `true`, otherwise the name is not included in the output at all.

  Parameters:
    `writer` - the `Writer` to which all output is sent.
    `name` - the logger name, may be `null`.

Method Detail

### getWriter

    public java.io.Writer getWriter()

  Returns the `Writer` to which all output is sent.

  Returns:
    the `Writer` to which all output is sent.

### getName

    public java.lang.String getName()

  Returns the name of this logger.

  Returns:
    the name of this logger, may be `null`.

### error

    public void error(java.lang.String message)

  Description copied from interface: `Logger`
  Logs a message at the ERROR level.

  Specified by:
    `error` in interface `Logger`
  Parameters:
    `message` - the message to log.

### warn

    public void warn(java.lang.String message)

  Description copied from interface: `Logger`
  Logs a message at the WARN level.

  Specified by:
    `warn` in interface `Logger`
  Parameters:
    `message` - the message to log.

### info

    public void info(java.lang.String message)

  Description copied from interface: `Logger`
  Logs a message at the INFO level.

  Specified by:
    `info` in interface `Logger`
  Parameters:
    `message` - the message to log.

### debug

    public void debug(java.lang.String message)

  Description copied from interface: `Logger`
  Logs a message at the DEBUG level.

  Specified by:
    `debug` in interface `Logger`
  Parameters:
    `message` - the message to log.

### isErrorEnabled

    public boolean isErrorEnabled()

  Description copied from interface: `Logger`
  Indicates whether logging is enabled at the ERROR level.

  Specified by:
    `isErrorEnabled` in interface `Logger`
  Returns:
    `true` if logging is enabled at the ERROR level, otherwise `false`.

### setErrorEnabled

    public void setErrorEnabled(boolean errorEnabled)

  Sets whether logging is enabled at the ERROR level.

  Parameters:
    `errorEnabled` - determines whether logging is enabled at the ERROR level.

### isWarnEnabled

    public boolean isWarnEnabled()

  Description copied from interface: `Logger`
  Indicates whether logging is enabled at the WARN level.

  Specified by:
    `isWarnEnabled` in interface `Logger`
  Returns:
    `true` if logging is enabled at the WARN level, otherwise `false`.

### setWarnEnabled

    public void setWarnEnabled(boolean warnEnabled)

  Sets whether logging is enabled at the WARN level.

  Parameters:
    `warnEnabled` - determines whether logging is enabled at the WARN level.

### isInfoEnabled

    public boolean isInfoEnabled()

  Description copied from interface: `Logger`
  Indicates whether logging is enabled at the INFO level.

  Specified by:
    `isInfoEnabled` in interface `Logger`
  Returns:
    `true` if logging is enabled at the INFO level, otherwise `false`.

### setInfoEnabled

    public void setInfoEnabled(boolean infoEnabled)

  Sets whether logging is enabled at the INFO level.

  Parameters:
    `infoEnabled` - determines whether logging is enabled at the INFO level.

### isDebugEnabled

    public boolean isDebugEnabled()

  Description copied from interface: `Logger`
  Indicates whether logging is enabled at the DEBUG level.

  Specified by:
    `isDebugEnabled` in interface `Logger`
  Returns:
    `true` if logging is enabled at the DEBUG level, otherwise `false`.

### setDebugEnabled

    public void setDebugEnabled(boolean debugEnabled)

  Sets whether logging is enabled at the DEBUG level.

  Parameters:
    `debugEnabled` - determines whether logging is enabled at the DEBUG level.

### log

    protected void log(java.lang.String level,
                       java.lang.String message)

  Logs the specified message at the specified level.

  This method is called internally by the `error(String)`, `warn(String)`, `info(String)` and `debug(String)` methods, with the `level` argument set to the text "`ERROR`", "`WARN`", "`INFO`", or "`DEBUG`" respectively.

  The default implementation of this method sends the the output of `BasicLogFormatter.format``(level,message,``getName()``)` to the `Writer` specified in the class constructor, and then flushes it.

  Overriding this method in a subclass provides a convenient means of logging to a `Writer` using a different format.

  Parameters:
    `level` - a string representing the level of the log message.
    `message` - the message to log.

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD