4 releases (2 breaking)
0.3.0 | Oct 30, 2023 |
---|---|
0.2.1 | Feb 17, 2023 |
0.2.0 | Feb 7, 2022 |
0.1.0 | Sep 17, 2020 |
#1604 in Embedded development
654 downloads per month
Used in 4 crates
6KB
rtt-logger
Plain RTT
Logger
implementation
Documentation
License
Licensed under
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.
lib.rs
:
A logger implementation to use RTT with the Rust log
crate.
use log::{info, LevelFilter};
use rtt_logger::RTTLogger;
use rtt_target::rtt_init_print;
// logger configuration
const LOG_LEVEL: LevelFilter = LevelFilter::Info;
static LOGGER: RTTLogger = RTTLogger::new(LOG_LEVEL);
fn main() {
// logger setup
rtt_init_print!();
log::set_logger(&LOGGER)
.map(|()| log::set_max_level(LOG_LEVEL))
.unwrap();
// logger usage in main binary or in any library
info!("Hello World!");
}
Dependencies
~725KB