automotive-message-broker  0.13
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
DebugOut Class Reference

The DebugOut class represents a class used for outputing debug information The specified debug level will only be outputed if the debug level is => the debug threshhold Here's a simple example: More...

#include <debugout.h>

Public Member Functions

 DebugOut (int debugLevel=4)
 
DebugOut const & operator<< (const string &message) const
 
DebugOut const & operator<< (ostream &(*manip)(std::ostream &)) const
 
DebugOut const & operator<< (double val) const
 

Static Public Member Functions

static void setDebugThreshhold (int th)
 
static void setOutput (ostream &o)
 
static void setThrowWarn (bool v)
 
static void setThrowErr (bool v)
 
static const int getDebugThreshhold ()
 

Static Public Attributes

static const int Error = 1 << 16
 Error use when essential functionality is blocked.
 
static const int Warning = 1 << 24
 Warning use when non-essential functionality is bocked, or when workarounds exist.
 

Detailed Description

The DebugOut class represents a class used for outputing debug information The specified debug level will only be outputed if the debug level is => the debug threshhold Here's a simple example:

DebugOut::setDebugThreshhold(3);
DebugOut(DebugOut::Warning) << "This is a warning" << std::endl;
DebugOut(3) << "This will only show if the threshhold is 3 or lower." << std::endl;
ofstream logfile;
logfile.open("amb.log", ios::out | ios::trunc);
DebugOut::setOutput(logfile)
DebugOut::setThrowErr(true);
DebugOut::setThrowWarn(true);
DebugOut(DebugOut::Error) << "This will throw an exception." << std::endl;
DebugOut::setOutput(std::cerr);
DebugOut() << "This will log to stderr." << std::endl;

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