make mqtt logging configurable

This commit is contained in:
technyon
2022-12-23 23:24:34 +01:00
parent e2057e024b
commit 99e0c1568f
4 changed files with 27 additions and 10 deletions

View File

@@ -42,13 +42,17 @@ void W5500Device::initialize()
_mqttClient = new PubSubClient(*_ethClient);
_mqttClient->setBufferSize(_mqttMaxBufferSize);
_path = new char[200];
memset(_path, 0, sizeof(_path));
String pathStr = _preferences->getString(preference_mqtt_lock_path);
pathStr.concat(mqtt_topic_log);
strcpy(_path, pathStr.c_str());
Log = new MqttLogger(*_mqttClient, _path);
if(_preferences->getBool(preference_mqtt_log_enabled))
{
_path = new char[200];
memset(_path, 0, sizeof(_path));
String pathStr = _preferences->getString(preference_mqtt_lock_path);
pathStr.concat(mqtt_topic_log);
strcpy(_path, pathStr.c_str());
Log = new MqttLogger(*_mqttClient, _path);
}
reconnect();
}