27 #include "timestamp.h"
31 void debugOut(
const string &message);
70 void deprecateMethod(
const string &methodName,
const std::string & version);
89 mDebugLevel = debugLevel;
91 if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
95 out<<bufferTime(amb::currentTime())<<
" | ";
97 if(mDebugLevel == Error)
99 if(mDebugLevel == Warning)
104 DebugOut(
const std::string & toLog,
int debugLevel = 4)
107 (*this) << toLog << endl;
110 DebugOut const& operator << (
const string &message)
const
112 if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
121 DebugOut const& operator << (ostream & (*manip)(std::ostream&))
const
123 if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
129 if((mDebugLevel == Error && throwErr))
131 throw std::runtime_error(
"Abort on Error is set");
133 else if ((mDebugLevel == Warning && throwWarn))
135 throw std::runtime_error(
"Abort on Warning is set");
141 DebugOut const & operator << (
double val)
const
143 if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
152 static void setDebugThreshhold(
int th)
154 debugThreshhold = th;
157 static void setOutput(ostream &o)
162 static void setThrowWarn(
bool v)
167 static void setThrowErr(
bool v)
172 static const int getDebugThreshhold()
174 return debugThreshhold;
179 std::string bufferTime(
double time)
187 while(f.str().length() <= 15)
195 static int debugThreshhold;
196 static std::streambuf *buf;
197 static bool throwWarn;
198 static bool throwErr;