mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +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);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
Serial.flush();
|
||||
|
@ -7,4 +7,6 @@ void debugStop(void);
|
||||
|
||||
void serialPrintln(String debugText);
|
||||
|
||||
void syslogSend(uint8_t log, const char * debugText);
|
||||
|
||||
#endif
|
@ -15,7 +15,7 @@
|
||||
void debugPrintln(String debugText)
|
||||
{
|
||||
serialPrintln(debugText);
|
||||
// if(WiFi.isConnected()) syslog.log(LOG_INFO, debugText);
|
||||
syslogSend(0, debugText.c_str());
|
||||
}
|
||||
|
||||
void errorPrintln(String debugText)
|
||||
@ -23,11 +23,7 @@ void errorPrintln(String debugText)
|
||||
char buffer[256];
|
||||
sprintf_P(buffer, debugText.c_str(), PSTR("[ERROR] "));
|
||||
serialPrintln(buffer);
|
||||
if(WiFi.isConnected()) {
|
||||
char buffer[256];
|
||||
sprintf_P(buffer, debugText.c_str(), "");
|
||||
// syslog.log(LOG_ERR, buffer);
|
||||
}
|
||||
syslogSend(2, buffer);
|
||||
}
|
||||
|
||||
void warningPrintln(String debugText)
|
||||
@ -35,9 +31,5 @@ void warningPrintln(String debugText)
|
||||
char buffer[256];
|
||||
sprintf_P(buffer, debugText.c_str(), PSTR("[WARNING] "));
|
||||
serialPrintln(buffer);
|
||||
if(WiFi.isConnected()) {
|
||||
char buffer[256];
|
||||
sprintf_P(buffer, debugText.c_str(), "");
|
||||
// syslog.log(LOG_WARNING, buffer);
|
||||
}
|
||||
syslogSend(1, buffer);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user