2021-12-22 21:13:24 +01:00
|
|
|
|
2022-02-15 11:37:31 +01:00
|
|
|
#include "utils/SerialPrint.h"
|
2022-04-30 09:28:49 +03:00
|
|
|
#include "classes/IoTRTC.h"
|
|
|
|
|
|
|
|
|
|
extern IoTRTC *watch;
|
2021-12-22 21:13:24 +01:00
|
|
|
|
|
|
|
|
void SerialPrint(String errorLevel, String module, String msg) {
|
2022-04-30 09:28:49 +03:00
|
|
|
String tosend;
|
|
|
|
|
if (watch) tosend = watch->gettime("d.m.y H:i:s");
|
|
|
|
|
else tosend = prettyMillis(millis());
|
|
|
|
|
|
|
|
|
|
tosend = tosend + " [" + errorLevel + "] [" + module + "] " + msg;
|
2022-02-19 23:42:24 +01:00
|
|
|
Serial.println(tosend);
|
2021-12-22 21:13:24 +01:00
|
|
|
|
2022-02-22 16:40:46 +01:00
|
|
|
if (isNetworkActive()) {
|
|
|
|
|
if (jsonReadInt(settingsFlashJson, F("log")) != 0) {
|
|
|
|
|
standWebSocket.broadcastTXT("/log|" + tosend);
|
|
|
|
|
}
|
2022-02-19 23:42:24 +01:00
|
|
|
}
|
2021-12-22 21:13:24 +01:00
|
|
|
}
|