From 2ee44830d36812dd880723dbdfd8de3a35e8ef15 Mon Sep 17 00:00:00 2001 From: harreh3iesh <79946552+harreh3iesh@users.noreply.github.com> Date: Tue, 14 Apr 2026 19:50:59 -0400 Subject: [PATCH] mqtt: promote publish-error log paths to inform() for debuggability The two error branches in mqtt_publish() logged at debug(1), which is invisible at default syslog verbosity. A silently-dropped MQTT publish is the exact failure mode users report as 'MQTT just stopped working' with no errors anywhere in the logs. Raising these to inform() makes such drops legible at default verbosity and includes the target topic plus mosquitto_strerror() text in the non-NO_CONN branch so the diagnostic actually names the failing call site. --- mqtt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mqtt.c b/mqtt.c index 64cc1aa9..35361e39 100644 --- a/mqtt.c +++ b/mqtt.c @@ -259,10 +259,11 @@ void mqtt_publish(char *topic, char *data_in, uint32_t length_in) { MOSQ_ERR_SUCCESS) { switch (rc) { case MOSQ_ERR_NO_CONN: - debug(1, "[MQTT]: Publish failed: not connected to broker"); + inform("[MQTT]: Publish to topic \"%s\" failed: not connected to broker", fulltopic); break; default: - debug(1, "[MQTT]: Publish failed: unknown error"); + inform("[MQTT]: Publish to topic \"%s\" failed: %s (rc=%d)", fulltopic, + mosquitto_strerror(rc), rc); break; } }