automotive-message-broker  0.14.803
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Classes | Functions
debugout.h File 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 <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include "timestamp.h"

Go to the source code of this file.

Classes

class  DebugOut
 

Functions

void debugOut (const string &message)
 
void amb::deprecateMethod (const string &methodName, const std::string &version)
 deprecateMethod prints warning if method is used. Throws if version >= PROJECT_SERIES
 

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;