-
Notifications
You must be signed in to change notification settings - Fork 264
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
feat(esp-println): Add timestamp to logging #3194
base: main
Are you sure you want to change the base?
Conversation
I'm not against pulling in esp-hal (I am considering requiring an initializer that takes ownership of the peripheral used for logging), but we can do better I think by requiring an |
I'd much prefer an |
@@ -17,7 +17,7 @@ use esp_hal::timer::timg::TimerGroup; | |||
#[embassy_executor::task] | |||
async fn run() { | |||
loop { | |||
esp_println::println!("Hello world from embassy using esp-hal-async!"); | |||
log::info!("Hello world from embassy using esp-hal-async!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or... well, maybe? I would probably expect println! to print the timestamp, but also it can be equally unexpected sometimes...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've wanted to change these to demo the feature, but I can revert them back
I've refactored this PR to only provide a hook gated by the |
Could this be done easily outside esp-println? It's just a matter of writing a custom logger I'm thinking of #1843 which was closed because esp-println was meant to stay simple. |
- Introduce new `timestamp` feature to enable logging with a timestamp in millis, in the same format as the bootloader.
Generally yes - it should stay simple - but this seems to be simple enough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
timestamp
(non-default) feature to enable logging with a timestamp in millis, in the same format as the bootloader.Considering Rust offers no standard way to fetch time through APIs or traits, this new feature requires pullingesp-hal
as a dependency.Testing
I've tested the changes in a local project, and it both build with and without the feature enabled.