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

Draft: Add log support #890

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Draft: Add log support #890

wants to merge 3 commits into from

Conversation

jonathanpallant
Copy link
Contributor

This is a work-in-progress branch investigating whether you can grab the format string at logging time without breaking the 0.3 API.

It adds a new feature called 'no-interning' and a new transport crate called defmt-log which turns the feature on and uses it to grab the format string out of thin air (well, out of a &[u8] that's the same length as the size of a usize).

This is just an experiment for now.

If the 'no-interning' feature is set, instead of

#[export_name = "{JSON...}"]
static S: u8 = 0;
&S as *const _ as usize

You get:

static S: &'static str = "{JSON...}";
&S as *const _ as usize

Note that I had to change the size of the interned ID from u16 to usize, because with no-interning it's now a pointer to actual data.
This is a work in progress, but it shows how, with the new
`no-interning` feature, a crate can capture defmt log data, including
the actual format string, and render locally.

TODO: Actually parse the format string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant