C# Class CSJ2K.j2k.util.StreamMsgLogger

This class implements the MsgLogger interface for streams. Streams can be simple files, terminals, stdout, stderr, etc. The messages or simple strings are formatted using the linewidth given to the constructor.

Messages are printed to the 'err' stream if they are of severity WARNING or ERROR, otherwise they are printed to the 'out' stream. Simple strings are always printed the 'out' stream.

Inheritance: IMsgLogger
Show file Open project: cureos/csj2k

Public Methods

Method Description
flush ( ) : void

Writes any buffered data from the print() and println() methods to the device.

println ( string str, int flind, int ind ) : void

Prints the string 'str' to the 'out' stream, appending a newline. The message is reformatted to the line width given to the constructors and using 'flind' characters to indent the first line and 'ind' characters to indent the second line. However, any newlines appearing in 'str' are respected. The output device may or may not display the string until flush() is called, depending on the autoflush state of the PrintWriter, to be sure flush() should be called to write the string to the device. This method just prints the string, the string does not make part of a "message" in the sense that noe severity is associated to it.

printmsg ( int sev, string msg ) : void

Prints the message 'msg' to the output device, appending a newline, with severity 'sev'. The severity of the message is prepended to the message.

Protected Methods

Method Description
StreamMsgLogger ( Stream outstr, Stream errstr, int lw ) : System.IO

Constructs a StreamMsgLogger that uses 'outstr' as the 'out' stream, and 'errstr' as the 'err' stream. Note that 'outstr' and 'errstr' can be System.out and System.err.

StreamMsgLogger ( StreamWriter outstr, StreamWriter errstr, int lw ) : System.IO

Constructs a StreamMsgLogger that uses 'outstr' as the 'out' stream, and 'errstr' as the 'err' stream. Note that 'outstr' and 'errstr' can be System.out and System.err.

Method Details

StreamMsgLogger() protected method

Constructs a StreamMsgLogger that uses 'outstr' as the 'out' stream, and 'errstr' as the 'err' stream. Note that 'outstr' and 'errstr' can be System.out and System.err.
protected StreamMsgLogger ( Stream outstr, Stream errstr, int lw ) : System.IO
outstr System.IO.Stream Where to print simple strings and LOG and INFO messages. ///
errstr System.IO.Stream Where to print WARNING and ERROR messages ///
lw int The line width to use in formatting ///
return System.IO

StreamMsgLogger() protected method

Constructs a StreamMsgLogger that uses 'outstr' as the 'out' stream, and 'errstr' as the 'err' stream. Note that 'outstr' and 'errstr' can be System.out and System.err.
protected StreamMsgLogger ( StreamWriter outstr, StreamWriter errstr, int lw ) : System.IO
outstr System.IO.StreamWriter Where to print simple strings and LOG and INFO messages. ///
errstr System.IO.StreamWriter Where to print WARNING and ERROR messages ///
lw int The line width to use in formatting ///
return System.IO

flush() public method

Writes any buffered data from the print() and println() methods to the device.
public flush ( ) : void
return void

println() public method

Prints the string 'str' to the 'out' stream, appending a newline. The message is reformatted to the line width given to the constructors and using 'flind' characters to indent the first line and 'ind' characters to indent the second line. However, any newlines appearing in 'str' are respected. The output device may or may not display the string until flush() is called, depending on the autoflush state of the PrintWriter, to be sure flush() should be called to write the string to the device. This method just prints the string, the string does not make part of a "message" in the sense that noe severity is associated to it.
public println ( string str, int flind, int ind ) : void
str string The string to print ///
flind int Indentation of the first line ///
ind int Indentation of any other lines. ///
return void

printmsg() public method

Prints the message 'msg' to the output device, appending a newline, with severity 'sev'. The severity of the message is prepended to the message.
public printmsg ( int sev, string msg ) : void
sev int The message severity (LOG, INFO, etc.) ///
msg string The message to display ///
return void