diff --git a/interface/src/project/EMSESPSettingsController.tsx b/interface/src/project/EMSESPSettingsController.tsx
index 46060536e..f883aead6 100644
--- a/interface/src/project/EMSESPSettingsController.tsx
+++ b/interface/src/project/EMSESPSettingsController.tsx
@@ -237,7 +237,9 @@ function EMSESPSettingsControllerForm(props: EMSESPSettingsControllerFormProps)
variant="outlined"
onChange={handleValueChange('syslog_level')}
margin="normal">
+
+
@@ -245,7 +247,7 @@ function EMSESPSettingsControllerForm(props: EMSESPSettingsControllerFormProps)
validators={['required', 'isNumber', 'minNumber:0', 'maxNumber:65535']}
errorMessages={['Syslog Mark is required', "Must be a number", "Must be 0 or higher", "Max value is 10"]}
name="syslog_mark_interval"
- label="Syslog Mark Interval (seconds)"
+ label="Syslog Mark Interval (seconds, 0=off)"
fullWidth
variant="outlined"
value={data.syslog_mark_interval}
diff --git a/src/system.cpp b/src/system.cpp
index aea35479b..756f0b76e 100644
--- a/src/system.cpp
+++ b/src/system.cpp
@@ -39,6 +39,11 @@ uint16_t System::analog_ = 0;
bool System::analog_enabled_ = false;
bool System::syslog_enabled_ = false;
std::string System::hostname_;
+int8_t System::syslog_level_ = -1;
+uint32_t System::syslog_mark_interval_ = 0;
+String System::syslog_host_;
+
+
// send on/off to a gpio pin
// value: true = HIGH, false = LOW
@@ -120,6 +125,13 @@ void System::syslog_init() {
});
#ifndef EMSESP_STANDALONE
+ if (!syslog_enabled_) {
+ syslog_.log_level((uuid::log::Level)-1);
+ syslog_.mark_interval(0);
+ syslog_.destination(0);
+ return;
+ }
+
syslog_.start(); // syslog service re-start
// configure syslog
@@ -155,9 +167,6 @@ void System::start() {
Command::add(EMSdevice::DeviceType::SYSTEM, settings.ems_bus_id, F_(send), System::command_send);
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info);
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F_(report), System::command_report);
- if (settings.syslog_enabled) {
- syslog_init(); // init SysLog
- }
});
@@ -172,8 +181,8 @@ void System::init() {
EMSESP::webSettingsService.read([&](WebSettings & settings) {
Helpers::bool_format(settings.bool_format);
analog_enabled_ = settings.analog_enabled;
- syslog_enabled_ = settings.syslog_enabled;
});
+ syslog_init(); // init SysLog
EMSESP::esp8266React.getWiFiSettingsService()->read([&](WiFiSettings & settings) { hostname(settings.hostname.c_str()); });
diff --git a/src/system.h b/src/system.h
index 32b6a8fae..808b189fa 100644
--- a/src/system.h
+++ b/src/system.h
@@ -59,9 +59,9 @@ class System {
static void show_mem(const char * note);
static void set_led();
static void init();
+ static void syslog_init();
bool check_upgrade();
- void syslog_init();
void send_heartbeat();
static std::string hostname() {
@@ -108,13 +108,13 @@ class System {
static std::string hostname_;
// settings
- static bool hide_led_;
- static bool syslog_enabled_;
- uint8_t syslog_level_;
- uint32_t syslog_mark_interval_;
- String syslog_host_;
- static uint8_t led_gpio_;
- static bool analog_enabled_;
+ static bool hide_led_;
+ static bool syslog_enabled_;
+ static int8_t syslog_level_;
+ static uint32_t syslog_mark_interval_;
+ static String syslog_host_;
+ static uint8_t led_gpio_;
+ static bool analog_enabled_;
};
} // namespace emsesp