1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-16 07:23:07 +01:00

improve logging MT robustness

This commit is contained in:
andreas
2021-11-13 18:15:50 +01:00
parent 6ef75422d8
commit b3f4a11a8e
6 changed files with 62 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ class GwLogWriter{
public:
virtual ~GwLogWriter(){}
virtual void write(const char *data)=0;
virtual void flush(){};
};
class GwLog{
private:
@@ -25,6 +26,7 @@ class GwLog{
void logString(const char *fmt,...);
void logDebug(int level, const char *fmt,...);
int isActive(int level){return level <= logLevel;};
void flush();
};
#define LOG_DEBUG(level,...){ if (logger != NULL && logger->isActive(level)) logger->logDebug(level,__VA_ARGS__);}