Logging facility for endpoints

Fork of ErrorHandler by Doug Anson

Revision:
6:be3ca195f0d1
Parent:
5:7b3bbd74c1b1
Child:
9:cec063a0b9a9
--- a/ErrorHandler.cpp	Tue Sep 09 20:22:45 2014 +0000
+++ b/ErrorHandler.cpp	Wed Sep 17 21:36:03 2014 +0000
@@ -107,6 +107,25 @@
     }
  } 
  
+ // VARARGS: log 
+ void ErrorHandler::logConsole(const char *format, ...)  { 
+    // construct the log message
+    memset(this->m_message,0,MAX_LOG_MESSAGE+1);
+    va_list args;
+    va_start(args, format);
+    vsprintf(this->m_message, format, args);
+    va_end(args);
+    
+    // make sure we have a message to log
+    if (strlen(this->m_message) > 0) {
+       // Log to serial...
+       if (this->m_pc != NULL) {
+            this->m_pc->printf(this->m_message);
+            this->m_pc->printf("\r\n");
+       }
+    }
+ } 
+ 
  // set the color LED 
  void ErrorHandler::setRGBLED(float H, float S, float V) {
     float f,h,p,q,t;