-
Notifications
You must be signed in to change notification settings - Fork 6
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
[RFC] Add logging support #28
base: master
Are you sure you want to change the base?
Conversation
# How We Teach This | ||
[how-we-teach-this]: #how-we-teach-this | ||
|
||
This should be added to the book as its own `Safe logging` chapter. |
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 would name the chapter 'non-blocking logging', 'real-time logging' or something like that. cortex-m-funnel
is not the only memory safe global logger; the log
and stlog
crates also provide memory safe global loggers and would also be candidates for a 'Safe logging' chapter.
|
||
```rust | ||
// Base size of 256 bytes, but the queue for priority 7 is of 1024 bytes | ||
#[app(logger = [base = 256, 7 = 1024])] |
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.
The syntax of the #[app]
arguments can be anything; the downside is that it never gets formatted by rustfmt
. I personally would prefer not to enter so much data as an attribute arguments but can't think of a better syntax right now.
// ... | ||
``` | ||
|
||
The final implementation of the logging is very simple. Simply, based on the analysis, fill out the [`cortex-m-funnel`] macro. |
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.
cortex-m-funnel only supports ufmt
atm; do we want to wait for core::fmt
support before implementing this?
# Drawbacks | ||
[drawbacks]: #drawbacks | ||
|
||
* Increase of complexity of RTFM, but I would argue that this is of much greater help than not to have it. |
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.
it also ties RTFM semver to cortex-m-funnel version so if we release a RTFM that uses cortex-m-funnel v0.1 it probably won't work with the log!
macro of cortex-m-funnel v0.2. I'm unsure about what kind of error you would get in that case; perhaps a linker error or perhaps all data that goes through the v0.2 of log!
would be silently loss
Summary
Add native logging support to RTFM using priority based buffers as in
cortex-m-funnel
.Rendered