Files
IoTManager/src/utils/SerialPrint.cpp

29 lines
927 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "utils/SerialPrint.h"
void SerialPrint(const String& errorLevel, const String& module, const String& msg, const String& itemId) {
String tosend = prettyMillis(millis());
tosend += " [";
tosend += errorLevel;
tosend += "] [";
tosend += module;
tosend += "] ";
tosend += msg;
Serial.println(tosend);
// if (isNetworkActive()) { // все проверки происходят в sendStringToWs()
if (jsonReadInt(settingsFlashJson, F("log")) != 0) {
sendStringToWs(F("corelg"), tosend, -1);
}
// }
if (errorLevel == "E") {
cleanString(tosend);
// создаем событие об ошибке для возможной реакции в сценарии
if (itemId != "") {
createItemFromNet(itemId + F("_onError"), tosend, 1);
} else {
// createItemFromNet("onError", tosend, -4);
}
}
}