Draft: Add log support#890
Draft
jonathanpallant wants to merge 3 commits intomainfrom
Draft
Conversation
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.
e2fa4d4 to
90fbd01
Compare
Deploying knurling-defmt-book with
|
| Latest commit: |
90fbd01
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7cf166b3.knurling-defmt-book.pages.dev |
| Branch Preview URL: | https://add-log-support.knurling-defmt-book.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-logwhich 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 ausize).