mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 13:16:45 +00:00
Move syslog function
This commit is contained in:
parent
ec429820b4
commit
cbcefad900
@ -70,6 +70,22 @@ void serialPrintln(String debugText)
|
|||||||
Serial.println(debugTimeText);
|
Serial.println(debugTimeText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void syslogSend(uint8_t log, const char * debugText)
|
||||||
|
{
|
||||||
|
if(WiFi.isConnected() && debugSyslogHost != "") {
|
||||||
|
switch(log) {
|
||||||
|
case 1:
|
||||||
|
syslog.log(LOG_WARNING, debugText);
|
||||||
|
break;
|
||||||
|
case2:
|
||||||
|
syslog.log(LOG_ERR, debugText);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
syslog.log(LOG_INFO, debugText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void debugStop()
|
void debugStop()
|
||||||
{
|
{
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
|
@ -7,4 +7,6 @@ void debugStop(void);
|
|||||||
|
|
||||||
void serialPrintln(String debugText);
|
void serialPrintln(String debugText);
|
||||||
|
|
||||||
|
void syslogSend(uint8_t log, const char * debugText);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -15,7 +15,7 @@
|
|||||||
void debugPrintln(String debugText)
|
void debugPrintln(String debugText)
|
||||||
{
|
{
|
||||||
serialPrintln(debugText);
|
serialPrintln(debugText);
|
||||||
// if(WiFi.isConnected()) syslog.log(LOG_INFO, debugText);
|
syslogSend(0, debugText.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void errorPrintln(String debugText)
|
void errorPrintln(String debugText)
|
||||||
@ -23,11 +23,7 @@ void errorPrintln(String debugText)
|
|||||||
char buffer[256];
|
char buffer[256];
|
||||||
sprintf_P(buffer, debugText.c_str(), PSTR("[ERROR] "));
|
sprintf_P(buffer, debugText.c_str(), PSTR("[ERROR] "));
|
||||||
serialPrintln(buffer);
|
serialPrintln(buffer);
|
||||||
if(WiFi.isConnected()) {
|
syslogSend(2, buffer);
|
||||||
char buffer[256];
|
|
||||||
sprintf_P(buffer, debugText.c_str(), "");
|
|
||||||
// syslog.log(LOG_ERR, buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void warningPrintln(String debugText)
|
void warningPrintln(String debugText)
|
||||||
@ -35,9 +31,5 @@ void warningPrintln(String debugText)
|
|||||||
char buffer[256];
|
char buffer[256];
|
||||||
sprintf_P(buffer, debugText.c_str(), PSTR("[WARNING] "));
|
sprintf_P(buffer, debugText.c_str(), PSTR("[WARNING] "));
|
||||||
serialPrintln(buffer);
|
serialPrintln(buffer);
|
||||||
if(WiFi.isConnected()) {
|
syslogSend(1, buffer);
|
||||||
char buffer[256];
|
|
||||||
sprintf_P(buffer, debugText.c_str(), "");
|
|
||||||
// syslog.log(LOG_WARNING, buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user