knurling-rs / defmt

Efficient, deferred formatting for logging on embedded systems
https://defmt.ferrous-systems.com/
Apache License 2.0
861 stars 79 forks source link

Optionally offer stable hashes as interned log IDs #891

Open jonathanpallant opened 2 days ago

jonathanpallant commented 2 days ago

Currently we take the address of a symbol as the interned log ID. This is good because it is guaranteed unique across the whole binary (that is the linker's job).

However, if you are combining multiple linked images together (e.g. using Hubris) the IDs are no longer unique.

We should add an optional feature which causes defmt to use the unique discriminator as the interned ID. This will make the log frames larger, but that's why it should be optional.

teburd commented 1 day ago

I think if you could add an optional unique identifier alongside the existing log id, (e.g. some build specific identifier) this would solve all the cases noted before.