Skip to content

Commit a2e8456

Browse files
committed
fix(mqtt): log sensitive data only in debug
1 parent f79f1aa commit a2e8456

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mqtt_example/src/mqtt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use embedded_svc::mqtt::client::{EventPayload, QoS};
22
use esp_idf_svc::mqtt::client::{EspMqttClient, EspMqttConnection, MqttClientConfiguration};
33
use esp_idf_svc::sys::esp_crt_bundle_attach;
4-
use log::info;
4+
use log::*;
55
use std::sync::mpsc;
66
use std::thread;
77
use std::thread::{sleep, Scope, ScopedJoinHandle};
@@ -37,7 +37,7 @@ pub fn spawn_receiver_thread<'scope>(
3737
info!("[MQTT] Listening for messages");
3838
while let Ok(event) = mqtt_connection.next() {
3939
let payload = event.payload();
40-
info!("[MQTT] {}", payload);
40+
debug!("[MQTT] {}", payload);
4141
if let EventPayload::Received {
4242
id: _,
4343
topic,
@@ -51,7 +51,7 @@ pub fn spawn_receiver_thread<'scope>(
5151
sleep(Duration::from_millis(500))
5252
}
5353
}
54-
info!("[MQTT] Connection closed");
54+
error!("[MQTT] Connection closed");
5555
})
5656
}
5757

@@ -61,7 +61,7 @@ pub fn try_until_subscribed(mqtt_client: &mut EspMqttClient, topic: &str) {
6161
sleep(Duration::from_millis(500));
6262
continue;
6363
}
64-
info!("[MQTT] Subscribed to {topic}");
64+
debug!("[MQTT] Subscribed to {topic}");
6565
break;
6666
}
6767
}

0 commit comments

Comments
 (0)