00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include "Debug.h"
00013
using namespace OpenCAL;
00014
00015
using namespace std;
00016
00017
00018
00019 unsigned int Debug::m_debugLevel = 1;
00020 ostringstream Debug::stream;
00021 unsigned int Debug::maxLevel = 10;
00022
00023
00024
00025
00026
00027
00028
void Debug::print(
const string &message,
unsigned int debugLevel)
00029 {
00030
if(debugLevel >
m_debugLevel)
return;
00031
00032 cerr << message << endl;
00033 }
00034
00035
void Debug::printStream(
unsigned int debugLevel)
00036 {
00037
if(debugLevel <= m_debugLevel)
00038 ;
00039
00040 stream.str() =
'\0';
00041 stream.clear();
00042 }
00043
00044
void Debug::initWarning(
const string &className,
unsigned int debugLevel)
00045 {
00046
if(debugLevel > m_debugLevel)
return;
00047
00048 stream <<
"The " << className <<
" isn't initialized yet. ";
00049 stream <<
"Doing that first..." << endl;
00050 stream <<
"You know, it is a really good idea ";
00051 stream <<
"to do this in your initialisation phase!" << endl;
00052
00053 printStream(debugLevel);
00054 }