feat: log MQTT publication outcomes

This commit is contained in:
Yurii committed 2026-11-26 05:49:03 +03:00
1 parent d1240ad5f6
commit a3c3b4faa9
1 file changed
+11 -1
+11 -1
View File
@@ -85,7 +85,17 @@ std::string mqttTopic(std::initializer_list<std::string_view> parts) {
}
static bool publishValue(const std::string& topic, std::string_view value) {
return mqttClient->publish(topic.c_str(), value, true);
const bool published = mqttClient->publish(topic.c_str(), value, true);
ESP_LOGD(
L_MQTT, "%s publish topic: %s, value: %.*s",
published ? "Successfully" : "Failed",
topic.c_str(),
static_cast<int>(value.size()),
value.empty() ? "" : value.data()
);
return published;
}
static bool publishValue(const std::string& topic, const char* value) {