mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-16 07:23:07 +01:00
introduce debug log
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include "GwLog.h"
|
||||
|
||||
GwLog::GwLog(bool logSerial){
|
||||
GwLog::GwLog(bool logSerial, int level){
|
||||
this->logSerial=logSerial;
|
||||
logLevel=level;
|
||||
}
|
||||
void GwLog::logString(const char *fmt,...){
|
||||
va_list args;
|
||||
@@ -11,4 +12,14 @@ void GwLog::logString(const char *fmt,...){
|
||||
Serial.print("LOG: ");
|
||||
Serial.println(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
void GwLog::logDebug(int level,const char *fmt,...){
|
||||
if (level > logLevel) return;
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
vsnprintf(buffer,99,fmt,args);
|
||||
if (logSerial){
|
||||
Serial.print("LOG: ");
|
||||
Serial.println(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user