A output stream to enable certain levels of verbosity. More...
#include <mia/core/msgstream.hh>
Public Types | |
enum | Level { ml_trace, ml_debug, ml_info, ml_message, ml_warning, ml_fail, ml_error, ml_fatal, ml_undefined } |
Public Member Functions | |
void | flush () |
write pending output More... | |
vstream::Level | get_level () const |
operator std::ostream & () | |
vstream & | operator<< (Level const l) |
template<class T > | |
vstream & | operator<< (const T &text) |
vstream & | operator<< (std::ostream &(*f)(std::ostream &)) |
std::ostream & | set_stream (std::ostream &os) |
void | set_verbosity (Level l) |
bool | show_debug () const |
bool | shows (Level l) const |
Static Public Member Functions | |
static vstream & | instance () |
static void | set_output_target (std::ostream *os) |
A output stream to enable certain levels of verbosity.
This class impelemtns a std::ostream like class to output messages during run-time, supporting various levels of verbosity. The class is implemened as a singleton. On initialization it is set to use std::cerr as output stream, but this can be replaced by any type implementing the std::ostream interface.
Definition at line 55 of file msgstream.hh.
enum vstream::Level |
Output verbosity level threshhold, ml_trace is the lowest threshhold and ml_fatal the highest. Output is written, when the output threshold is above or equal to the one set within the output stream.
Definition at line 62 of file msgstream.hh.
|
inline |
write pending output
Definition at line 270 of file msgstream.hh.
|
inline |
Definition at line 265 of file msgstream.hh.
|
static |
initialise a stream that writes only messages above a certain verbosity level
Referenced by CTrace::CTrace(), cvdebug(), cverr(), cvfail(), cvfatal(), cvinfo(), cvmsg(), cvwarn(), and CTrace::~CTrace().
|
inline |
Transparent conversion operator to an std::ostream.
Definition at line 141 of file msgstream.hh.
References EXPORT_CORE, g_verbose_dict, output, and set_verbose().
a special handling to set the output level "inline"
l | the level of the following messages |
|
inline |
general output routine; output is only given, if the data verbosity level is set higher or equal to the stream verbosity level. x1
text | the text to be written to the stream |
Definition at line 118 of file msgstream.hh.
References operator<<().
vstream& vstream::operator<< | ( | std::ostream &(*)(std::ostream &) | f | ) |
A funny construct to enable std::endl to work on this stream idea of Dave Brondsema: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8567
|
static |
Set the output target with which the stream should be initialized if std::cerr is not to be used.
std::ostream& vstream::set_stream | ( | std::ostream & | os | ) |
sets the output stream
os |
void vstream::set_verbosity | ( | Level | l | ) |
set the verbosity output level
l |
|
inline |
Definition at line 258 of file msgstream.hh.
|
inline |
l | verbosity level |
Definition at line 172 of file msgstream.hh.