Interface MsgLogger

All Known Implementing Classes:
J2KImageReader, StreamMsgLogger

public interface MsgLogger
This class provides a simple common abstraction of a facility that logs and/or displays messages or simple strings. The underlying facility can be a terminal, text file, text area in a GUI display, dialog boxes in a GUI display, etc., or a combination of those.

Messages are short strings (a couple of lines) that indicate some state of the program, and that have a severity code associated with them (see below). Simple strings is text (can be long) that has no severity code associated with it. Typical use of simple strings is to display help texts.

Each message has a severity code, which can be one of the following: LOG, INFO, WARNING, ERROR. Each implementation should treat each severity code in a way which corresponds to the type of diplay used.

Messages are printed via the 'printmsg()' method. Simple strings are printed via the 'print()', 'println()' and 'flush()' methods, each simple string is considered to be terminated once the 'flush()' method has been called. The 'printmsg()' method should never be called before a previous simple string has been terminated.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Severity of message.
    static final int
    Severity of message.
    static final int
    Severity of message.
    static final int
    Severity of message.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Writes any buffered data from the println() method to the device.
    void
    println(String str, int flind, int ind)
    Prints the string 'str' to the output device, appending a line return.
    void
    printmsg(int sev, String msg)
    Prints the message 'msg' to the output device, appending a newline, with severity 'sev'.
  • Field Details

    • LOG

      static final int LOG
      Severity of message. LOG messages are just for bookkeeping and do not need to be displayed in the majority of cases
      See Also:
    • INFO

      static final int INFO
      Severity of message. INFO messages should be displayed just for user feedback.
      See Also:
    • WARNING

      static final int WARNING
      Severity of message. WARNING messages denote that an unexpected state has been reached and should be given as feedback to the user.
      See Also:
    • ERROR

      static final int ERROR
      Severity of message. ERROR messages denote that something has gone wrong and probably that execution has ended. They should be definetely displayed to the user.
      See Also:
  • Method Details

    • printmsg

      void printmsg(int sev, String msg)
      Prints the message 'msg' to the output device, appending a newline, with severity 'sev'. Some implementations where the appended newline is irrelevant may not append the newline. Depending on the implementation the severity of the message may be added to it. The message is reformatted as appropriate for the output devic, but any newline characters are respected.
      Parameters:
      sev - The message severity (LOG, INFO, etc.)
      msg - The message to display
    • println

      void println(String str, int flind, int ind)
      Prints the string 'str' to the output device, appending a line return. The message is reformatted as appropriate to the particular diplaying device, where 'flind' and 'ind' are used as hints for performing that operation. However, any newlines appearing in 'str' are respected. The output device may not display the string until flush() is called. Some implementations may automatically flush when this method is called. This method just prints the string, the string does not make part of a "message" in the sense that no severity is associated to it.
      Parameters:
      str - The string to print
      flind - Indentation of the first line
      ind - Indentation of any other lines.
    • flush

      void flush()
      Writes any buffered data from the println() method to the device.