Created
August 21, 2020 20:25
-
-
Save bobmcwhirter/7105bd3a0091b36c631e97f32d128cb1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 16:23:55.925 INFO - about to panic |
This file contains hidden or 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
| #![no_std] | |
| use log::{ | |
| Metadata, | |
| Record | |
| }; | |
| use rtt_target::rprintln; | |
| pub struct RTTLogger; | |
| impl log::Log for RTTLogger { | |
| fn enabled(&self, _metadata: &Metadata) -> bool { | |
| true | |
| } | |
| fn log(&self, record: &Record) { | |
| if self.enabled(record.metadata()) { | |
| rprintln!("{} - {}", record.level(), record.args()); | |
| } | |
| } | |
| fn flush(&self) { | |
| } | |
| } | |
| #[cfg(test)] | |
| mod tests { | |
| #[test] | |
| fn it_works() { | |
| assert_eq!(2 + 2, 4); | |
| } | |
| } |
This file contains hidden or 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
| info!("about to panic"); | |
| panic!("well dang"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment