Repository navigation
feat(core): core log lines reach defmt (#352) - #361
Merged
Merged
Conversation
`aimdb-core` (log macros forward to defmt, `LogDisplay`/`LogDebug`, the `defmt::Format` impls, the macro contract and the dropped mirrors), `aimdb-zenoh-connector` (defmt feature), `aimdb-knx-connector` (direct defmt dependency, `ip_in_core`), `aimdb-mqtt-connector` (no duplicate defmt lines), and the root changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPDjQ947yKjLLAq3Xzgu3e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #352: on an Embassy device, core's own log lines never reached the probe log.
aimdb-core/src/log.rsforwardedlog_*!only totracingandlog, and the places that mattered on the device mirrored todefmtby hand. The session engine had no mirrors at all, so the session reset (#328) andserve's accept-failure summary (#351) could only be inferred from their effect while testing on the board.This merges the feature branch
feat/352-log-defmt. Each step was reviewed as its own PR into that branch:defmt::Formatfor every type core's log lines format: derived forTransportError,CodecError,AuthError,FrameFault;DbErrorandSerializeFailurethrough theirDisplaytext (DbError'sstdvariants carryio::Error, and docs.rs builds with every feature on);defmt/allocforString/Vec<String>/Arc<str>; a compile-time guarddefmtarm in the fivelog_*!macros;LogDisplay/LogDebugfor foreign types (10 call sites in the zenoh and MQTT std backends, sostd+defmtbuilds stay green); KNXdep:defmt+ip_in_core; zenoh gets adefmtfeature;check-cfgin the std-onlyaimdb-sync/aimdb-uds-connector;thumbv7emchecks for core and zenoh withdefmtin the Makefiledefmtmirrors that now duplicated alog_*!line (core router 3, session client 1, MQTT embedded 3). Thedefmt-only lines without alog_*!counterpart stayaimdb-core,aimdb-zenoh-connector,aimdb-knx-connector,aimdb-mqtt-connector, rootHow the scope was found
I temporarily added the
defmtarm to the macros and built every crate that can build withdefmtforthumbv7em. The compiler listed every missing piece: theFormatimpls,defmt/alloc, KNX's direct dependency andSocketAddr. The--all-featuresbuilds then showed the foreign types in zenoh's and MQTT's std backends. A check againstdefmt 1.0.1confirmed thatdefmtaccepts the existing format strings, including{:?}, so no call site's text changed.Contract change
The macros are
#[macro_export]ed:defmtneedsdep:defmtitself, becausedefmt's macros expand to absolute paths;defmt::Format, or be wrapped inLogDisplay/LogDebug;defmtnames the feature viacheck-cfg.Normal (
tracing/log) builds are unaffected. Details are inlog.rsand the changelog.Live on a NUCLEO-H563ZI
The device's
defmtlog now shows (with a temporary TCP server on port 0 and a record without a free slot):The summary at 1,000 attempts didn't appear in that run. The logic is unit-tested (#351); the likely cause is
defmt-rttdropping lines when its buffer fills during the startup burst.Verified locally
thumbv7emcheck/clippy line for core, MQTT, KNX, serial, TCP and zenoh, including the newdefmtlines.cargo check/cargo doc -D warnings --all-featuresfor core, zenoh, MQTT and serial.aimdb-knx-connector --all-featuresalready failed before this branch (inaimdb-knx-pico 0.3.1), so it's unrelated.Follow-up
#357: typed operational events (design), with the session engine as a pilot.
Related Issue
Checklist
Formatguard, andthumbv7emdefmtchecks in the Makefile.)make check). The affected crates pass locally; the full run is left to CI.🤖 Generated with Claude Code
https://claude.ai/code/session_01YPDjQ947yKjLLAq3Xzgu3e