This commit is contained in:
Yuri Trikoz
2020-10-18 10:17:24 +03:00
parent 281f338f97
commit 8778de1ffd
4 changed files with 26 additions and 20 deletions

View File

@@ -6,7 +6,6 @@
#include "Errors.h"
#include "Global.h"
#define pm PrintMessage(MODULE)
class PrintMessage {
@@ -24,8 +23,23 @@ class PrintMessage {
}
private:
void printErrorLevel(ErrorLevel_t level) {
Serial.printf("[%c] ", getErrorLevelStr(level));
}
void printUptime() {
Serial.printf("%lu ", ((unsigned long)millis() / 1000));
}
void printModule() {
Serial.printf("[%s] ", _module);
}
void print(const ErrorLevel_t level, const String& str) {
Serial.printf("%s [%s] [%s] %s\n", prettyMillis(millis()).c_str(), getErrorLevelStr(level).c_str(), _module, str.c_str());
printUptime();
printErrorLevel(level);
printModule();
Serial.println(str.c_str());
}
private: