diff --git a/pio-scripts/inject_syslog_ui.py b/pio-scripts/inject_syslog_ui.py
index 00f2013a2..7bb8beda4 100644
--- a/pio-scripts/inject_syslog_ui.py
+++ b/pio-scripts/inject_syslog_ui.py
@@ -37,42 +37,6 @@ SYSLOG_HTML = """
Enable Syslog:
Host:
Port:
-
-
-
"""
@@ -120,15 +84,9 @@ def inject_syslog_ui(source, target, env, retry_count=0):
original = f.read()
modified = original
- # replace existing section if present
- if '' in modified and '' in modified:
- start = modified.index('')
- end = modified.index('') + len('')
- modified = (
- modified[:start]
- + '\n' + SYSLOG_HTML + '\n'
- + modified[end:]
- )
+ # replace the single comment with HTML
+ if '' in modified:
+ modified = modified.replace('', SYSLOG_HTML)
else:
# insert before last
idx = modified.rfind('
')
@@ -137,7 +95,7 @@ def inject_syslog_ui(source, target, env, retry_count=0):
return
modified = (
modified[:idx]
- + '\n' + SYSLOG_HTML + '\n\n'
+ + SYSLOG_HTML + '\n'
+ modified[idx:]
)
@@ -160,7 +118,7 @@ def inject_syslog_ui(source, target, env, retry_count=0):
# verify that SYSLOG markers really are in the file
with open(html_path, 'r', encoding='utf8') as f:
content = f.read()
- if '' not in content or '' not in content:
+ if '' not in content:
print("Backup exists but SYSLOG markers missing—forcing re-injection.")
os.remove(bak)
# only retry up to 3 times
diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp
index f400ea2e6..5e0694492 100644
--- a/wled00/cfg.cpp
+++ b/wled00/cfg.cpp
@@ -541,9 +541,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
CJSON(syslogEnabled, if_syslog["en"]);
getStringFromJson(syslogHost, if_syslog[F("host")], 33);
CJSON(syslogPort, if_syslog["port"]);
- // CJSON(syslogProtocol, if_syslog["proto"]);
- // CJSON(syslogFacility, if_syslog["fac"]);
- // CJSON(syslogSeverity, if_syslog["sev"]);
#endif
JsonObject if_ntp = interfaces[F("ntp")];
@@ -1066,9 +1063,6 @@ void serializeConfig(JsonObject root) {
if_syslog["en"] = syslogEnabled;
if_syslog["host"] = syslogHost;
if_syslog["port"] = syslogPort;
- // if_syslog["proto"] = syslogProtocol;
- // if_syslog["fac"] = syslogFacility;
- // if_syslog["sev"] = syslogSeverity;
#endif
JsonObject if_ntp = interfaces.createNestedObject("ntp");
diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm
index 6745817e8..983d0a6cb 100644
--- a/wled00/data/settings_sync.htm
+++ b/wled00/data/settings_sync.htm
@@ -237,7 +237,7 @@ Baud rate:
Keep at 115200 to use Improv. Some boards may not support high rates.
-
+
diff --git a/wled00/set.cpp b/wled00/set.cpp
index da159b517..1db411af4 100644
--- a/wled00/set.cpp
+++ b/wled00/set.cpp
@@ -479,16 +479,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
t = request->arg(F("SL_port")).toInt();
if (t > 0) syslogPort = t;
-
- // t = request->arg(F("SL_proto")).toInt();
- // if (t >= SYSLOG_PROTO_BSD && t <= SYSLOG_PROTO_RAW) syslogProtocol = t;
-
- // t = request->arg(F("SL_fac")).toInt();
- // if (t >= SYSLOG_KERN && t <= SYSLOG_LOCAL7) syslogFacility = t;
-
- // t = request->arg(F("SL_sev")).toInt();
- // if (t >= SYSLOG_EMERG && t <= SYSLOG_DEBUG) syslogSeverity = t;
-
+
Syslog.begin(syslogHost, syslogPort,
syslogFacility, syslogSeverity, syslogProtocol);
diff --git a/wled00/syslog.cpp b/wled00/syslog.cpp
index 9ee59c318..384a937e4 100644
--- a/wled00/syslog.cpp
+++ b/wled00/syslog.cpp
@@ -3,42 +3,6 @@
#include "syslog.h"
-// Comment out but preserve the protocol names
-/*
-static const char* const protoNames[] PROGMEM = {
- PSTR("BSD"),
- PSTR("RFC5424"),
- PSTR("RAW"),
- PSTR("UNKNOWN")
-};
-static const uint8_t protoCount = sizeof(protoNames)/sizeof(*protoNames);
-*/
-
-// Comment out but preserve facility names
-/*
-// We fill invalid entries with PSTR("UNKNOWN") so we can index 0..24 safely
-static const char* const facilityNames[] PROGMEM = {
- PSTR("KERN"), PSTR("USER"), PSTR("UNKNOWN"), PSTR("DAEMON"),
- PSTR("UNKNOWN"),PSTR("SYSLOG"), PSTR("UNKNOWN"), PSTR("UNKNOWN"),
- PSTR("UNKNOWN"),PSTR("UNKNOWN"),PSTR("UNKNOWN"), PSTR("UNKNOWN"),
- PSTR("UNKNOWN"),PSTR("UNKNOWN"),PSTR("UNKNOWN"), PSTR("UNKNOWN"),
- PSTR("LCL0"), PSTR("LCL1"), PSTR("LCL2"), PSTR("LCL3"),
- PSTR("LCL4"), PSTR("LCL5"), PSTR("LCL6"), PSTR("LCL7"),
- PSTR("UNKNOWN") // catch-all at index 24
-};
-static const uint8_t facCount = sizeof(facilityNames)/sizeof(*facilityNames);
-*/
-
-// Comment out but preserve severity names
-/*
-static const char* const severityNames[] PROGMEM = {
- PSTR("EMERG"), PSTR("ALERT"), PSTR("CRIT"), PSTR("ERR"),
- PSTR("WARN"), PSTR("NOTE"), PSTR("INFO"), PSTR("DEBUG"),
- PSTR("UNKNOWN")
-};
-static const uint8_t sevCount = sizeof(severityNames) / sizeof(*severityNames);
-*/
-
SyslogPrinter::SyslogPrinter() :
_lastOperationSucceeded(true),
_lastErrorMessage(""),
@@ -55,24 +19,6 @@ void SyslogPrinter::begin(const char* host, uint16_t port,
DEBUG_PRINTF_P(PSTR(" Hostname: %s\n"), host);
DEBUG_PRINTF_P(PSTR(" Cached IP: %s\n"), syslogHostIP.toString().c_str());
DEBUG_PRINTF_P(PSTR(" Port: %u\n"), (unsigned)port);
-
- /*
- // Protocol
- uint8_t pidx = protocol < (protoCount - 1) ? protocol : (protoCount - 1);
- const char* pstr = (const char*)pgm_read_ptr(&protoNames[pidx]);
- DEBUG_PRINTF_P(PSTR(" Protocol: %u (%s)\n"), (unsigned)protocol, pstr);
-
- // — Facility
- uint8_t fidx = facility < (facCount - 1) ? facility : (facCount - 1);
- const char* fstr = (const char*)pgm_read_ptr(&facilityNames[fidx]);
- DEBUG_PRINTF_P(PSTR(" Facility: %u (%s)\n"), (unsigned)facility, fstr);
-
- // Severity
- uint8_t idx = severity < sevCount-1 ? severity : sevCount-1;
- const char* sevStr = (const char*)pgm_read_ptr(&severityNames[idx]);
- DEBUG_PRINTF_P(PSTR(" Severity: %u (%s)\n"), (unsigned)severity, sevStr);
- */
-
DEBUG_PRINTF_P(PSTR("======================================\n"));
strlcpy(syslogHost, host, sizeof(syslogHost));
@@ -211,76 +157,35 @@ size_t SyslogPrinter::write(const uint8_t *buf, size_t size, uint8_t severity) {
String cleanHostname = String(serverDescription);
cleanHostname.replace(' ', '_');
- // Handle different syslog protocol formats
- // Note: Only BSD protocol is currently implemented; RFC5424 and RAW are preserved for future use
- // switch (_protocol) {
- // case SYSLOG_PROTO_BSD:
- // RFC 3164 format: TIMESTAMP HOSTNAME APP-NAME: MESSAGE
- syslogUdp.printf("<%d>", pri);
-
- if (ntpEnabled && ntpConnected) {
- // Month abbreviation
- static const char* const months[] = {
- "Jan","Feb","Mar","Apr","May","Jun",
- "Jul","Aug","Sep","Oct","Nov","Dec"
- };
+ // Note: Only BSD protocol is currently implemented
+ syslogUdp.printf("<%d>", pri);
+
+ if (ntpEnabled && ntpConnected) {
+ // Month abbreviation
+ static const char* const months[] = {
+ "Jan","Feb","Mar","Apr","May","Jun",
+ "Jul","Aug","Sep","Oct","Nov","Dec"
+ };
- syslogUdp.printf("%s %2d %02d:%02d:%02d ",
- months[month(localTime) - 1],
- day(localTime),
- hour(localTime),
- minute(localTime),
- second(localTime));
- } else {
- // No valid time available
- syslogUdp.print(F("Jan 01 00:00:00 "));
- }
-
- // Add hostname and app name
- syslogUdp.print(cleanHostname);
- syslogUdp.print(" ");
- syslogUdp.print(_appName);
- syslogUdp.print(": ");
-
- // Add message content
- size = syslogUdp.write(buf, size);
- /*
- break;
-
- case SYSLOG_PROTO_RFC5424:
- // RFC 5424 format: VERSION TIMESTAMP HOSTNAME APP-NAME PROCID MSGID STRUCTURED-DATA MSG
- syslogUdp.printf("<%d>1 ", pri); // Version is always 1
-
- if (ntpEnabled && ntpConnected) {
- syslogUdp.printf("%04d-%02d-%02dT%02d:%02d:%02dZ ",
- year(localTime),
- month(localTime),
- day(localTime),
- hour(localTime),
- minute(localTime),
- second(localTime));
- } else {
- // No valid time available
- syslogUdp.print(F("1970-01-01T00:00:00Z "));
- }
-
- // Add hostname, app name, and other fields (using - for empty fields)
- syslogUdp.print(cleanHostname);
- syslogUdp.print(" ");
- syslogUdp.print(_appName);
- syslogUdp.print(F(" - - - ")); // PROCID, MSGID, and STRUCTURED-DATA are empty
-
- // Add message content
- size = syslogUdp.write(buf, size);
- break;
-
- case SYSLOG_PROTO_RAW:
- default:
- // Just send the raw message (like original NetDebug)
- size = syslogUdp.write(buf, size);
- break;
+ syslogUdp.printf("%s %2d %02d:%02d:%02d ",
+ months[month(localTime) - 1],
+ day(localTime),
+ hour(localTime),
+ minute(localTime),
+ second(localTime));
+ } else {
+ // No valid time available
+ syslogUdp.print(F("Jan 01 00:00:00 "));
}
- */
+
+ // Add hostname and app name
+ syslogUdp.print(cleanHostname);
+ syslogUdp.print(" ");
+ syslogUdp.print(_appName);
+ syslogUdp.print(": ");
+
+ // Add message content
+ size = syslogUdp.write(buf, size);
syslogUdp.endPacket();
return size;
diff --git a/wled00/syslog.h b/wled00/syslog.h
index 46c220347..98b4e3913 100644
--- a/wled00/syslog.h
+++ b/wled00/syslog.h
@@ -8,42 +8,11 @@
#define SYSLOG_BUFFER_SIZE 128
#endif
-// Syslog facility codes - commented out but preserved
-/*
-#define SYSLOG_KERN 0 // kernel messages
-#define SYSLOG_USER 1 // user-level messages
-#define SYSLOG_DAEMON 3 // system daemons
-#define SYSLOG_SYSLOG 5 // messages generated internally by syslogd
-*/
#define SYSLOG_LOCAL0 16 // local use 0
-/*
-#define SYSLOG_LOCAL1 17 // local use 1
-#define SYSLOG_LOCAL2 18 // local use 2
-#define SYSLOG_LOCAL3 19 // local use 3
-#define SYSLOG_LOCAL4 20 // local use 4
-#define SYSLOG_LOCAL5 21 // local use 5
-#define SYSLOG_LOCAL6 22 // local use 6
-#define SYSLOG_LOCAL7 23 // local use 7
-*/
-
-// Syslog severity levels - commented out but preserved
-/*
-#define SYSLOG_EMERG 0 // Emergency: system is unusable
-#define SYSLOG_ALERT 1 // Alert: action must be taken immediately
-#define SYSLOG_CRIT 2 // Critical: critical conditions
-#define SYSLOG_ERR 3 // Error: error conditions
-#define SYSLOG_WARNING 4 // Warning: warning conditions
-#define SYSLOG_NOTICE 5 // Notice: normal but significant condition
-#define SYSLOG_INFO 6 // Informational: informational messages
-*/
#define SYSLOG_DEBUG 7 // Debug: debug-level messages
// Syslog protocol formats - commented out but preserved
#define SYSLOG_PROTO_BSD 0 // Legacy BSD format (RFC 3164)
-/*
-#define SYSLOG_PROTO_RFC5424 1 // Modern syslog format (RFC 5424)
-#define SYSLOG_PROTO_RAW 2 // Raw text (like original NetDebug)
-*/
class SyslogPrinter : public Print {
private: