mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-26 08:13:06 +05:00
feat: log MQTT publication outcomes
This commit is contained in:
1 parent
d1240ad5f6
commit
a3c3b4faa9
1 file changed
+11
-1
+11
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user