Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a unique interface to the logger crate #477

Open
ia0 opened this issue May 21, 2024 · 0 comments
Open

Support a unique interface to the logger crate #477

ia0 opened this issue May 21, 2024 · 0 comments
Labels
crate:logger Modifies the log API for:maintainability Improves maintainers life for:usability Improves users (and maintainers) life good first issue Good for newcomers needs:implementation Needs implementation to complete

Comments

@ia0
Copy link
Member

ia0 commented May 21, 2024

Currently the format for defmt and log and different. It would be much more convenient to have a unique syntax for a common (and restricted) subset of those, typically to print common types like integers, strings, and bytes.

The idea would be to change the logger crate to be a proc-macro crate, and do the format conversion logic at compile-time. The goal is that such logic:

#[cfg(not(feature = "defmt"))]
Some(result) => log::debug!("Reading {:02x?}", result),
#[cfg(feature = "defmt")]
Some(result) => log::debug!("Reading {=[u8]:02x}", result),

would be a single line:

Some(result) => log::debug!("Reading {:02x?}", result),

See knurling-rs/defmt#149 for a similar issue in the defmt repository.

@ia0 ia0 added needs:implementation Needs implementation to complete for:usability Improves users (and maintainers) life for:maintainability Improves maintainers life crate:logger Modifies the log API labels May 21, 2024
@ia0 ia0 added the good first issue Good for newcomers label Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate:logger Modifies the log API for:maintainability Improves maintainers life for:usability Improves users (and maintainers) life good first issue Good for newcomers needs:implementation Needs implementation to complete
Projects
None yet
Development

No branches or pull requests

1 participant