added error and warning options to debugout
authorKevron Rees <kevron_m_rees@linux.intel.com>
Fri, 17 May 2013 20:46:07 +0000 (13:46 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Fri, 17 May 2013 20:46:07 +0000 (13:46 -0700)
lib/debugout.cpp
lib/debugout.h

index f766971..e0c8a49 100644 (file)
@@ -23,7 +23,10 @@ using namespace std;
 int DebugOut::debugThreshhold = 0;
 std::streambuf * DebugOut::buf = cout.rdbuf();
 
+const int DebugOut::Error = 9999999999;
+const int DebugOut::Warning = 9999999998;
+
 void debugOut(string message)
 {
-       cout<<"DEBUG: "<<message<<endl;
+       DebugOut()<<"DEBUG: "<<message<<endl;
 }
index 807b0a5..1506c63 100644 (file)
@@ -32,7 +32,11 @@ void debugOut(string message);
 
 class DebugOut 
 {
-public: 
+public:
+
+       static const int Error;
+       static const int Warning;
+
        DebugOut(int debugLevel = 4)
        {
                mDebugLevel = debugLevel;
@@ -40,8 +44,15 @@ public:
 
                out.precision(15);
 
-               if(mDebugLevel <= debugThreshhold)
+               if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
+               {
                        out<<bufferTime(amb::currentTime())<<" | ";
+
+                       if(mDebugLevel == Error)
+                               out<<" ERROR ";
+                       if(mDebugLevel == Warning)
+                               out<<" WARNING ";
+               }
        }
 
        DebugOut const& operator << (string message) const
@@ -66,15 +77,6 @@ public:
                return *this;
        }
        
-       /*DebugOut const & operator << (uint16_t val) const
-       {
-               ostream out(buf);
-
-               if(mDebugLevel <= debugThreshhold)
-                        out<<val<<" ";
-               return *this;
-       }*/
-
        DebugOut const & operator << (double val) const
        {
                ostream out(buf);