guard-clause use of syslog object
This commit is contained in:
@@ -13,7 +13,9 @@
|
|||||||
*/
|
*/
|
||||||
NoopPrint noopPrint;
|
NoopPrint noopPrint;
|
||||||
|
|
||||||
|
#if HAS_WIFI || HAS_ETHERNET
|
||||||
extern Syslog syslog;
|
extern Syslog syslog;
|
||||||
|
#endif
|
||||||
|
|
||||||
void RedirectablePrint::setDestination(Print *_dest)
|
void RedirectablePrint::setDestination(Print *_dest)
|
||||||
{
|
{
|
||||||
@@ -99,6 +101,7 @@ size_t RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
|||||||
}
|
}
|
||||||
r += vprintf(format, arg);
|
r += vprintf(format, arg);
|
||||||
|
|
||||||
|
#if HAS_WIFI || HAS_ETHERNET
|
||||||
// if syslog is in use, collect the log messages and send them to syslog
|
// if syslog is in use, collect the log messages and send them to syslog
|
||||||
if (syslog.isEnabled()) {
|
if (syslog.isEnabled()) {
|
||||||
int ll = 0;
|
int ll = 0;
|
||||||
@@ -123,6 +126,7 @@ size_t RedirectablePrint::log(const char *logLevel, const char *format, ...)
|
|||||||
}
|
}
|
||||||
syslog.vlogf(ll, format, arg);
|
syslog.vlogf(ll, format, arg);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user