UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MessageLogger Class Reference

This class is used to stream log messages. More...

#include <MessageLogger.h>

Public Member Functions

 MessageLogger (std::ostream &ostr)
 Creates a new MessageLogger which will use the given output stream to stream messages.
 
virtual ~MessageLogger ()
 Destroys the current MessageLogger instance.
 
std::ostream & newMsg (LogTypes logType)
 Creates a new log message of the given type. More...
 
std::ostream & contMsg ()
 Return the output stream for the currently streamed log message. More...
 
std::ostream & newUserInfo ()
 Creates a new log message for user information. More...
 
std::ostream & newDebug ()
 Creates a new log message for debug information. More...
 
std::ostream & newWarning ()
 Creates a new log message for warnings. More...
 
std::ostream & newError ()
 Creates a new log message for errors. More...
 
std::ostream & newCriticalError ()
 Creates a new log message for critical errors. More...
 
void endMsg ()
 Ends the currently stream message.
 

Private Member Functions

void streamCurrentTime (std::ostream &ost)
 Streams the current time stamp in the format 'day.month.year hour:minute:second'. More...
 
std::ostream & streamHeader (std::ostream &ost, LogTypes logType)
 Streams a header for a log message of the given type to the given stream. More...
 

Private Attributes

std::ostream devnull
 This output stream discards all information sent to it.
 
std::ostream & mainstream
 Stores the output stream given this MessageLogger while instantiation. More...
 
LogTypes currLevel
 Stores the log level of the message currently streamed.
 
bool messageStreaming
 Stores whether there is a message currently streamed.
 

Detailed Description

This class is used to stream log messages.

Log messages of different types can be created by calling the appropriate functions, which will return a reference to an output stream. This stream can then be used to stream the message. If the message is finished, the endMsg() function needs to be called. If the message is still unfinished, contMsg() can be used to retrieve the current output stream.

Author
Jan Stückrath

Member Function Documentation

ostream & contMsg ( )

Return the output stream for the currently streamed log message.

If no message is streamed currently, then a new one is created using a default header.

Returns
the output stream reference to which the message can be written
ostream & newCriticalError ( )

Creates a new log message for critical errors.

This will create a header consisting of the current date, time and log type. The returned output stream can be used to write the messages content. The message must be ended via endMsg().

See Also
endMsg()
Returns
an output stream reference to which the message can be written
ostream & newDebug ( )

Creates a new log message for debug information.

This will create a header consisting of the current date, time and log type. The returned output stream can be used to write the messages content. The message must be ended via endMsg().

See Also
endMsg()
Returns
an output stream reference to which the message can be written
ostream & newError ( )

Creates a new log message for errors.

This will create a header consisting of the current date, time and log type. The returned output stream can be used to write the messages content. The message must be ended via endMsg().

See Also
endMsg()
Returns
an output stream reference to which the message can be written
ostream & newMsg ( LogTypes  logType)

Creates a new log message of the given type.

This will create a header consisting of the current date, time and log type. The returned output stream can be used to write the messages content. The message must be ended via endMsg().

See Also
endMsg()
Parameters
logTypethe log type of which the message should be
Returns
an output stream reference to which the message can be written
ostream & newUserInfo ( )

Creates a new log message for user information.

This will create a header consisting of the current date, time and log type. The returned output stream can be used to write the messages content. The message must be ended via endMsg().

See Also
endMsg()
Returns
an output stream reference to which the message can be written
ostream & newWarning ( )

Creates a new log message for warnings.

This will create a header consisting of the current date, time and log type. The returned output stream can be used to write the messages content. The message must be ended via endMsg().

See Also
endMsg()
Returns
an output stream reference to which the message can be written
void streamCurrentTime ( std::ostream &  ost)
private

Streams the current time stamp in the format 'day.month.year hour:minute:second'.

Parameters
ostthe stream to which the current time stamp will be printed
ostream & streamHeader ( std::ostream &  ost,
LogTypes  logType 
)
private

Streams a header for a log message of the given type to the given stream.

This includes a time stamp and an abbreviation of the messages log type.

Parameters
ostthe stream to which the header will be printed
logTypethe type of the log message for which the header will be generated

Member Data Documentation

std::ostream& mainstream
private

Stores the output stream given this MessageLogger while instantiation.

Will be used for streaming the log messages.


The documentation for this class was generated from the following files: