LoggerStream class that is a std::ostream replacement that will log each line. More...
#include <ored/utilities/log.hpp>
Public Member Functions | |
LoggerStream (unsigned mask, const char *filename, unsigned lineNo) | |
~LoggerStream () | |
destructor - this is when the logging takes place. More... | |
operator std::ostream & () | |
cast this LoggerStream as a ostream& More... | |
Private Attributes | |
unsigned | mask_ |
const char * | filename_ |
unsigned | lineNo_ |
std::stringstream | ss_ |
LoggerStream class that is a std::ostream replacement that will log each line.
LoggerStream is a simple wrapper around a std::string stream, it has an explicit cast std::ostream& method so it can be used in place of any std::ostream, this can be used with QuantExt methods that take a std::ostream& for logging purposes.
Once the stream falls out of focus, it's destructor will take the buffered log messages and pass them the main ore::data::Log::instance().
Note the following
The LoggerStream relies on falling out of scope to trigger the logging, as such they should not be created using the new operator.
The proper usage is to use the macro LOGGERSTREAM and DLOGGERSTREAM, if a function takes a std::ostream& as a parameter, use the macro instead.
LoggerStream | ( | unsigned | mask, |
const char * | filename, | ||
unsigned | lineNo | ||
) |
Definition at line 471 of file log.cpp.
~LoggerStream | ( | ) |
destructor - this is when the logging takes place.
Definition at line 478 of file log.cpp.
operator std::ostream & | ( | ) |