top | item 41328703

(no title)

username81 | 1 year ago

Are there libraries like this, but in rust? As far as I understand, it relies on C's preprocessor, so it is impossible to create bindings for another language.

discuss

order

cmptrnerd6|1 year ago

I have not used this and it says it targets embedded systems but maybe it is close enough to what you might be looking for: https://github.com/knurling-rs/defmt

steveklabnik|1 year ago

I have used this, but not the library in the link. From the link’s README, they’re at least analogous. While maybe not the exact same thing, they’re at least the same idea.

andrepd|1 year ago

Sounds like something that would be doable in rust. I'm not sure how you would go about building the compile-time table of log locations and format strings, sounds like the hardest part.

wtetzner|1 year ago

> I'm not sure how you would go about building the compile-time table of log locations and format strings, sounds like the hardest part.

Sounds like a job for a macro.