Created
July 23, 2020 16:16
-
-
Save mtthw-meyer/0c1d4977cfbb848916f92830c35c852c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use log::{Record, Level, Metadata}; | |
#[cfg(any(feature = "rtt"))] | |
use rtt_target::{rprintln, rtt_init_print}; | |
pub struct Logger; | |
impl Logger { | |
pub fn init(&self) { | |
#[cfg(any(feature = "rtt"))] | |
rtt_init_print!(); | |
} | |
} | |
impl log::Log for Logger { | |
fn enabled(&self, metadata: &Metadata) -> bool { | |
true | |
} | |
fn log(&self, record: &Record) { | |
#[cfg(any(feature = "rtt"))] | |
rprintln!("{} - {}", record.level(), record.args()); | |
} | |
fn flush(&self) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment