Crate defmt_ringbuf
source ·Expand description
defmt global logger into a persistent ring buffer.
To use this crate, link to it by importing it somewhere in your project.
// src/main.rs or src/bin/my-app.rs
use defmt_ringbuf as _;Call init to initialize logging and read to read buffered log data.
Critical section implementation
This crate uses critical-section to ensure only one thread
is writing to the buffer at a time. You must import a crate that provides a critical-section implementation
suitable for the current target. See the critical-section README for details.
For example, for single-core privileged-mode Cortex-M targets, you can add the following to your Cargo.toml.
[dependencies]
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"]}
Structs
- Ring buffer.
Traits
- Ring buffer access methods.
Functions
- init⚠Initializes logging to a ring buffer.
- Reads and removes data from the log buffer.