mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
33 lines
664 B
C++
33 lines
664 B
C++
#pragma once
|
|
|
|
#include "Arduino.h"
|
|
#include "CommonTypes.h"
|
|
#include "Utils\StringUtils.h"
|
|
#include "Utils\TimeUtils.h"
|
|
#include "Errors.h"
|
|
|
|
#define pm PrintMessage(MODULE)
|
|
|
|
class PrintMessage {
|
|
public:
|
|
PrintMessage(const char* module) {
|
|
_module = module;
|
|
}
|
|
|
|
void error(const String str) {
|
|
print(EL_ERROR, str);
|
|
}
|
|
|
|
void info(const String str) {
|
|
print(EL_INFO, str);
|
|
}
|
|
|
|
private:
|
|
void print(const ErrorLevel_t level, const String& str) {
|
|
Serial.printf("%s [%s] [%s] %s\n", prettyMillis().c_str(), getErrorLevelStr(level).c_str(), _module, str.c_str());
|
|
}
|
|
|
|
private:
|
|
const char* _module;
|
|
};
|