From 21848bd5ae5f163e3add306db0163fbadf41567f Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 15 Dec 2023 11:33:48 +0100 Subject: [PATCH] Enhancement: log to syslog server instead of web-serial --- src/app.cpp | 3 +++ src/app.h | 4 ++++ src/config/config_override_example.h | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/src/app.cpp b/src/app.cpp index d670c696..82e25724 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -82,6 +82,9 @@ void app::setup() { mApi.setup(this, &mSys, mWeb.getWebSrvPtr(), mConfig); + #ifdef ENABLE_SYSLOG + mDbgSyslog.setup(mConfig); // be sure to init after mWeb.setup (webSerial uses also debug callback) + #endif // Plugins #if defined(PLUGIN_DISPLAY) if (mConfig->plugin.display.type != 0) diff --git a/src/app.h b/src/app.h index a71ee03c..a24cccb3 100644 --- a/src/app.h +++ b/src/app.h @@ -22,6 +22,7 @@ #include "utils/crc.h" #include "utils/dbg.h" #include "utils/scheduler.h" +#include "utils/syslog.h" #include "web/RestApi.h" #include "web/web.h" #include "hm/Communication.h" @@ -311,6 +312,9 @@ class app : public IApp, public ah::Scheduler { #endif /* defined(ETHERNET) */ WebType mWeb; RestApiType mApi; + #ifdef ENABLE_SYSLOG + DbgSyslog mDbgSyslog; + #endif //PayloadType mPayload; //MiPayloadType mMiPayload; PubSerialType mPubSerial; diff --git a/src/config/config_override_example.h b/src/config/config_override_example.h index c653bf10..b90bbdbd 100644 --- a/src/config/config_override_example.h +++ b/src/config/config_override_example.h @@ -35,4 +35,13 @@ // #define ENABLE_PROMETHEUS_EP +// to enable the syslog logging (will disable web-serial) +//#define ENABLE_SYSLOG +#ifdef ENABLE_SYSLOG +#define SYSLOG_HOST "" +#define SYSLOG_APP "ahoy" +#define SYSLOG_FACILITY FAC_USER +#define SYSLOG_PORT 514 +#endif + #endif /*__CONFIG_OVERRIDE_H__*/