Description
So I've been using defmt in a couple of libraries of mine and it's super nice!
However, when I want to add tests to the library that I run on my PC, defmt needs a global logger and there are no loggers that work for PC tests afaik.
What I want to propose is similar to #714, but maybe not quite the same.
I would like to see a feature flag that switches defmt over from using its own logger and deferred formatting to using println, panic, the log crate and Rust's built-in formatter.
I took a stab at it today, but only for the defmt::println
macro to try this out: main...diondokter:defmt:std-log
In essence I think it should be possible to translate the defmt formatting to the rust formatting which can then be routed to panic
, println
and log::****
as required.
This is pretty doable if the API would be that every type needs to implement Debug when in this mode, but theoretically it should be possible to use the Format
trait as input too.
So I want to know, is there interest in this? Has something in this direction a chance of being accepted?
If so I think I could spare some time to work on this.