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

Add a feature for logging panics with defmt #9

Closed
TheButlah opened this issue Sep 19, 2022 · 4 comments
Closed

Add a feature for logging panics with defmt #9

TheButlah opened this issue Sep 19, 2022 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@TheButlah
Copy link

TheButlah commented Sep 19, 2022

In line with the print-uart and print-rtt features, perhaps a print-defmt would make sense?

I am happy to submit a PR for this, however I have a question. The current implementation calls several println!() functions. In most defmt log printers, the contents of the log statement gets printed along with the location in the source code that the log statement was called.

Would this mean that we would have only one error!() invocation in the panic_handler? Or should we still call error!() each time we call println().

Also, due to this quirk of defmt vs println style printing, should I add this functionality to esp-println? Because it may be a mismatch of expected output format.

@bjoernQ
Copy link
Contributor

bjoernQ commented Sep 19, 2022

I'm not too familiar with defmt to be honest. Probably error!() is more like dbg! from the std-lib, then?
Sounds like you probably only want one invocation of error! in your implementation

By "should I add this functionality to esp-println" you mean printing the source code location? I don't think we should do that for println but if you like you can add a dbg macro just like https://github.com/rust-lang/rust/blob/efa717bc2d82c19c6957f362a936a6f95169d138/library/std/src/macros.rs#L339-L361 to esp-println

Otherwise, happy to receive a PR for this

@TheButlah
Copy link
Author

TheButlah commented Sep 19, 2022

By "should I add this functionality to esp-println" you mean printing the source code location?

No, I meant should I add a print-defmt feature to esp-println. I'm not sure if its a good match because defmt introduces its own formatting by attaching line numbers and log levels to each print. See this example:
Screen Shot 2022-09-19 at 12 24 20 PM

@jessebraham
Copy link
Member

jessebraham commented Sep 29, 2023

I'm just starting to learn defmt myself, but esp-println at least has support for it now. Maybe somebody can tackle this issue.

@jessebraham jessebraham added enhancement New feature or request help wanted Extra attention is needed labels Sep 29, 2023
@bjoernQ
Copy link
Contributor

bjoernQ commented Jan 15, 2024

I guess this is covered by #43

@bjoernQ bjoernQ closed this as completed Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Archived in project
Development

No branches or pull requests

3 participants