Interface MsgLogger
- All Known Implementing Classes:
J2KImageReader,StreamMsgLogger
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Writes any buffered data from the println() method to the device.voidPrints the string 'str' to the output device, appending a line return.voidPrints the message 'msg' to the output device, appending a newline, with severity 'sev'.
-
Field Details
-
LOG
static final int LOGSeverity 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 INFOSeverity of message. INFO messages should be displayed just for user feedback.- See Also:
-
WARNING
static final int WARNINGSeverity 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 ERRORSeverity 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
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
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 printflind- Indentation of the first lineind- Indentation of any other lines.
-
flush
void flush()Writes any buffered data from the println() method to the device.
-