defmt icon indicating copy to clipboard operation
defmt copied to clipboard

Expose custom message tags to users

Open jonas-schievink opened this issue 4 years ago • 2 comments

https://github.com/knurling-rs/defmt/pull/175 adds a tag to every message. We use it to store the log level, but downstream libraries could use it to mark messages for consumption by other host-side tooling. We should come up with an API to set a custom tag.

jonas-schievink avatar Oct 07 '20 15:10 jonas-schievink

In my opinion this (adding custom tags to messages) should wait until we have a stable API to decode defmt messages or at the very least JSON output (knurling-rs/probe-run#178); otherwise there's no stable way to use the messages from tooling or similar. Would you agree @jonas-schievink ?

Unless this meant tagging messages for use by knurling-rs tooling that we maintain.

japaric avatar Jun 23 '21 12:06 japaric

I like this idea. It would be great if we could convert this into a structured logging use case, where instead of having format string + data, we would have static string message + tag=value list. This can then be used on host side for multitude of things like, multiplexing streams, filtering data as needed, analyzing logs for detecting potential failures and so on.

It can also be used to include build numbers as part of the log message to ensure logs are being parsed by using the right binary. This can happen in cases where logs are locally stored and fetched as needed and logs could be a combination between previous version of the firmware and a newer version that was loaded as part of OTA.

adityashah1212 avatar Aug 03 '23 19:08 adityashah1212