debug.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <iostream>
00023
00024 #include "debug.h"
00025
00026
00027
00028 namespace Debug {
00029
00030 int Trace::debugLevel = NOTICE;
00031
00032 void Trace::setDebugLevel(debug_level lvl)
00033 {
00034 debugLevel = lvl;
00035 }
00036
00037 void Trace::print(int i)
00038 {
00039 std::cerr << i << " ";
00040 }
00041
00042 Trace & Trace::operator<<(int i)
00043 {
00044 if (m_level <= debugLevel) {
00045 std::cerr << i;
00046 }
00047 return *this;
00048 }
00049
00050 Trace & Trace::operator<<(const char * s)
00051 {
00052 if (m_level <= debugLevel) {
00053 std::cerr << s;
00054 }
00055 return *this;
00056 }
00057
00058 Trace & Trace::operator<<(void *p)
00059 {
00060 if (m_level <= debugLevel) {
00061 std::cerr << p;
00062 }
00063 return *this;
00064 }
00065
00066 Trace & Trace::operator<<(const std::string & s)
00067 {
00068 if (m_level <= debugLevel) {
00069 std::cerr << s;
00070 }
00071 return *this;
00072 }
00073
00074 }