Conversation
| #[cfg(not(all(feature = "defmt-v1", not(feature = "std"))))] | ||
| macro_rules! error { | ||
| // error!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log") | ||
| // error!(target: "my_target", "a {} event", "log") |
There was a problem hiding this comment.
These macro wrappers are really cool but it might be nice to document (in natural language) how this is meant to mimic defmt's spec.
I'm sort of torn on the comments - ordinarily in an std environment I'd say this is the perfect place to replace them with some doctests, but I'm not entirely sure how those work (or don't) on no-std projects. Either way I'd favor actual usage examples than standalone comments :)
There was a problem hiding this comment.
To be honest I just copy pasted the comments from the official log macros 😅, as of now it's just a prototype, it definetely needs to be reviewed.
There was a problem hiding this comment.
I'm sort of torn on the comments - ordinarily in an
stdenvironment I'd say this is the perfect place to replace them with some doctests, but I'm not entirely sure how those work (or don't) onno-stdprojects.
Doc tests (usually) run on the compiler host (so probably x86_64, or arm64), so considering that ergot runs both on microcontroller as well as normal PCs, running the doc tests shouldn't be a problem.
In most cases the consideration is on whether it is too much setup or not, which shouldn't be a problem in this case I think.
There was a problem hiding this comment.
I think the best way to demonstrate this functionality is with a fully fledged example.
What do you guys think would be the best way to do that?
One simple thing is to use a nop logger in the log-router-serial example, so that ergot's logs are not emitted.
this is needed to not conflict with std applications that don't need embassy-time, which is needed only by the embassy-usb-v0_5 interface implementation
Make ergot use the internal logger when using the log crate by using wrapper macros.