Package net.sf.saxon.lib

## Class Logger

- java.lang.Object
- - net.sf.saxon.lib.Logger

- Direct Known Subclasses:
    `StandardLogger`, `SystemLogger`

      public abstract class Logger
      extends java.lang.Object

  Interface to diagnostic event logging mechanism. A Logger can be registered at the level of the Saxon Configuration. The default implementation for the Java platform writes all messages to System.err

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DISASTER` |
    `static int` | `ERROR` |
    `static int` | `INFO` |
    `static int` | `WARNING` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Logger()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `javax.xml.transform.stream.StreamResult` | `asStreamResult()` | Get a JAXP `StreamResult` object allowing serialized XML to be written to the output destination of this Logger.
    `java.io.Writer` | `asWriter()` | Get a `Writer` whose effect is to send each line of written output as a separate INFO message to this Logger
    `void` | `close()` | Close the logger, indicating that no further messages will be written and that underlying streams should be closed, if they were created by the Logger itself rather than by the user.
    `void` | `disaster​(java.lang.String message)` | Log a message with level `DISASTER`
    `void` | `error​(java.lang.String message)` | Log a message with level `ERROR`
    `void` | `info​(java.lang.String message)` | Log a message with level `INFO`
    `boolean` | `isUnicodeAware()` | Ask whether the Logger is capable of handling the full Unicode character repertoire.
    `abstract void` | `println​(java.lang.String message, int severity)` | Log a message.
    `void` | `setUnicodeAware​(boolean aware)` | Say whether the Logger is capable of handling the full Unicode character repertoire.
    `void` | `warning​(java.lang.String message)` | Log a message with level `WARNING`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INFO

          public static final int INFO

      See Also:
        Constant Field Values

    - #### WARNING

          public static final int WARNING

      See Also:
        Constant Field Values

    - #### ERROR

          public static final int ERROR

      See Also:
        Constant Field Values

    - #### DISASTER

          public static final int DISASTER

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Logger

          public Logger()

  - ### Method Detail

    - #### info

          public void info​(java.lang.String message)

      Log a message with level `INFO`
      Parameters:
        `message` - the message to be logged

    - #### warning

          public void warning​(java.lang.String message)

      Log a message with level `WARNING`
      Parameters:
        `message` - the message to be logged

    - #### error

          public void error​(java.lang.String message)

      Log a message with level `ERROR`
      Parameters:
        `message` - the message to be logged

    - #### disaster

          public void disaster​(java.lang.String message)

      Log a message with level `DISASTER`
      Parameters:
        `message` - the message to be logged

    - #### println

          public abstract void println​(java.lang.String message,
                                       int severity)

      Log a message. To be implemented in a concrete subclass
      Parameters:
        `message` - The message to be output
        `severity` - The severity level. One of `INFO`, `WARNING`, `ERROR`, `DISASTER`

    - #### close

          public void close()

      Close the logger, indicating that no further messages will be written and that underlying streams should be closed, if they were created by the Logger itself rather than by the user.

    - #### isUnicodeAware

          public boolean isUnicodeAware()

      Ask whether the Logger is capable of handling the full Unicode character repertoire. By default this is false, because the default destination of console output is sensitive to the configured locale and is often limited to legacy character sets.
      Returns:
        true if the Logger can handle the full Unicode character repertoire. With the default value (false), the `StandardErrorListener` will output special characters using the notation C[xHHHH] where C is the character, and HHHH is its hexadecimal codepoint.

    - #### setUnicodeAware

          public void setUnicodeAware​(boolean aware)

      Say whether the Logger is capable of handling the full Unicode character repertoire. By default this is false, because the default destination of console output is sensitive to the configured locale and is often limited to legacy character sets.
      Parameters:
        `aware` - true if the Logger can handle the full Unicode character repertoire. With the default value (false), the `StandardErrorListener` will output special characters using the notation C[xHHHH] where C is the character, and HHHH is its hexadecimal codepoint.

    - #### asWriter

          public java.io.Writer asWriter()

      Get a `Writer` whose effect is to send each line of written output as a separate INFO message to this Logger
      Returns:
        a suitable `Writer`

    - #### asStreamResult

          public javax.xml.transform.stream.StreamResult asStreamResult()

      Get a JAXP `StreamResult` object allowing serialized XML to be written to the output destination of this Logger. The default implementation returns a `StreamResult` wrapping a custom `Writer` that writes the supplied text line by line using the `println(String, int)` method.
      Returns:
        a StreamResult that serializes XML to this Logger