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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user