UnCoVer (Using Coverability for Verification)
|
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. | |
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.
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.
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().
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().
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().
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().
logType | the log type of which the message should be |
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().
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().
|
private |
Streams the current time stamp in the format 'day.month.year hour:minute:second'.
ost | the stream to which the current time stamp will be printed |
|
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.
ost | the stream to which the header will be printed |
logType | the type of the log message for which the header will be generated |
|
private |
Stores the output stream given this MessageLogger while instantiation.
Will be used for streaming the log messages.