From 12e8a5eabbebae1c119ebe589ed346573ff1ffe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Schn=C3=B6rch?= Date: Sat, 24 Oct 2026 21:53:56 +0200 Subject: [PATCH] refactor: drop the defmt mirrors the log macros now cover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the `log_*!` macros forward to defmt (#359), a hand-written `#[cfg(feature = "defmt")] defmt::…!` next to a `log_*!` line logs the same event twice on the device. Removes the seven such pairs: three in `aimdb-core`'s router, one in its session client (mirror gap), three in the MQTT connector's embedded backend (qos=2 caps, oversized publish). The device now shows the `log_*!` text, which some of the mirrors had shortened. The defmt-only calls stay: they have no `log_*!` counterpart (the MQTT embedded backend's connect/TLS/SNTP lines, the Embassy adapter's runtime logger and slot error). Part of #352. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YPDjQ947yKjLLAq3Xzgu3e --- aimdb-core/src/router.rs | 13 ------------- aimdb-core/src/session/client.rs | 7 ------- aimdb-mqtt-connector/src/embedded/mod.rs | 10 ---------- aimdb-mqtt-connector/src/embedded/session_loop.rs | 11 ----------- 4 files changed, 41 deletions(-) diff --git a/aimdb-core/src/router.rs b/aimdb-core/src/router.rs index 38b34c2e..36c1e92a 100644 --- a/aimdb-core/src/router.rs +++ b/aimdb-core/src/router.rs @@ -154,13 +154,6 @@ impl Router { } Err(_e) => { log_warn!("Failed to ingest message on '{}': {}", resource_id, _e); - - #[cfg(feature = "defmt")] - defmt::warn!( - "Failed to ingest message on '{}': {}", - resource_id, - _e.as_str() - ); } } } @@ -172,14 +165,8 @@ impl Router { "Route matched for '{}' but message was not produced (ingest errors)", resource_id ); - - #[cfg(feature = "defmt")] - defmt::debug!("Route matched for '{}' but not produced", resource_id); } else { log_debug!("No route found for resource: '{}'", resource_id); - - #[cfg(feature = "defmt")] - defmt::debug!("No route found for resource: '{}'", resource_id); } } diff --git a/aimdb-core/src/session/client.rs b/aimdb-core/src/session/client.rs index 34d2c8aa..aef25a4b 100644 --- a/aimdb-core/src/session/client.rs +++ b/aimdb-core/src/session/client.rs @@ -927,13 +927,6 @@ async fn inbound_pump(handle: ClientHandle, inbound: crate::InboundDispatch, id: id.as_ref(), update.skipped ); - - #[cfg(feature = "defmt")] - defmt::warn!( - "mirror gap on '{}': {} update(s) lost (latest-state, no resync)", - id.as_ref(), - update.skipped - ); } inbound.dispatch(id.as_ref(), &update.data); } diff --git a/aimdb-mqtt-connector/src/embedded/mod.rs b/aimdb-mqtt-connector/src/embedded/mod.rs index ff4b871c..2787c9b4 100644 --- a/aimdb-mqtt-connector/src/embedded/mod.rs +++ b/aimdb-mqtt-connector/src/embedded/mod.rs @@ -185,11 +185,6 @@ fn inbound_topics( "MQTT: inbound route '{}' asks for qos=2; this backend subscribes at QoS 1 (at-least-once). The std backend honours qos=2 on the same URL.", route.topic ); - #[cfg(feature = "defmt")] - defmt::warn!( - "MQTT: inbound route '{}' asks qos=2; subscribing at QoS 1 (at-least-once)", - &*route.topic - ); } } @@ -227,11 +222,6 @@ fn prepare_outbound( "MQTT: route '{}' asks for qos=2; this backend publishes it at QoS 1 (at-least-once). The std backend honours qos=2 on the same URL.", route.default_topic ); - #[cfg(feature = "defmt")] - defmt::warn!( - "MQTT: route '{}' asks qos=2; publishing at QoS 1 (at-least-once)", - &*route.default_topic - ); } opts.push(opt); } diff --git a/aimdb-mqtt-connector/src/embedded/session_loop.rs b/aimdb-mqtt-connector/src/embedded/session_loop.rs index 382f8c14..21515c7d 100644 --- a/aimdb-mqtt-connector/src/embedded/session_loop.rs +++ b/aimdb-mqtt-connector/src/embedded/session_loop.rs @@ -456,17 +456,6 @@ async fn publish_staged( "write ring's" } ); - #[cfg(feature = "defmt")] - defmt::warn!( - "MQTT: skipping publish to {}: {} bytes exceed the {} limit", - msg.topic, - len, - if over_broker { - "broker's" - } else { - "write ring's" - } - ); true } else { ring.put_sized(&packet, len, CONTROL_RESERVE).await?;