de.esprit.common.log.logpr

## Interface LogPrinter

- All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable, LogLevelEvent.Source
  All Known Implementing Classes:
    AbstractLogPrinter, LogConsole, LogPrinterConsole, LogPrinterFile, LogPrinterFrame

      public interface LogPrinter
      extends LogLevelEvent.Source, java.io.Closeable

  This interface defines the methods of a log message handler. A class of this type is supposed to work as a message filter as well as a message formatter. It receives it's log messages from a `LogChannel` where it must be registered as a LogMessageEvent.Listener.

  #### Message filtering

  Log messages are be filtered by their `LogLevel` which is controlled with the `setLogLevel(LogLevel)` method. Log messages below the current LogLevel are not printed (except DUMP messages, which are always printed). You may stop/restart the processing of messages at all with the `setSilent(boolean)` method.

  #### Message formatting

  Log messages contain several detail informations which the user may or may not want to have reported in a log record. This is controlled by the `LogFormatter` which can be customized as needed.
  Author:
    Rainer Buesch
  See Also:
    `LogChannel`, `LogMessageEvent`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Deregisters the LogPrinter from the underlying LogChannel and releases all associated resources.
    `LogChannel` | `getLogChannel()` Returns the underlying `LogChannel` from where the messages are received.
    `LogFormatter` | `getLogFormatter()` Returns the formatter for formatting the logMessage
    `LogLevel` | `getLogLevel()` Returns the current log level in use.
    `TextPrintable` | `getOutput(LogLevel level)` Returns a `TextPrintable` where the message is printed to.
    `java.lang.String` | `getTypeString()` Returns a string identifying the type of this LogPrinter.
    `boolean` | `isSilent()` Tells whether this `LogPrinter` is in silent mode.
    `void` | `setLogLevel(LogLevel level)` Defines the 'importance level' as defined in `LogLevel`.
    `void` | `setSilent(boolean state)` Sets this `LogPrinter` into silent mode.

    - ### Methods inherited from interface de.esprit.common.log.LogLevelEvent.Source

      `addLogLevelListener, removeLogLevelListener`

- - ### Method Detail

    - #### getLogChannel

          LogChannel getLogChannel()

      Returns the underlying `LogChannel` from where the messages are received.

    - #### getTypeString

          java.lang.String getTypeString()

      Returns a string identifying the type of this LogPrinter.

    - #### getLogLevel

          LogLevel getLogLevel()

      Returns the current log level in use. If null, then the LogLevel of the parent LogChannel is used

    - #### setLogLevel

          void setLogLevel(LogLevel level)

      Defines the 'importance level' as defined in `LogLevel`.

    - #### setSilent

          void setSilent(boolean state)

      Sets this `LogPrinter` into silent mode. No further output will occur. Note that this does not affect the current `LogLevel`. After re-enabling reporting will continue in current `LogLevel`.

    - #### isSilent

          boolean isSilent()

      Tells whether this `LogPrinter` is in silent mode.

    - #### getOutput

          TextPrintable getOutput(LogLevel level)

      Returns a `TextPrintable` where the message is printed to. The output may be different for different `LogLevel`s.

    - #### getLogFormatter

          LogFormatter getLogFormatter()

      Returns the formatter for formatting the logMessage

    - #### close

          void close()

      Deregisters the LogPrinter from the underlying LogChannel and releases all associated resources.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `java.io.Closeable`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.