From 217207f60228073c75b422e7265da76130a84655 Mon Sep 17 00:00:00 2001 From: Lotte Steenbrink Date: Wed, 14 Apr 2021 12:12:02 +0200 Subject: [PATCH] use defmt in panic-log --- common/panic-log/Cargo.toml | 18 +++++++++++++++++- common/panic-log/src/lib.rs | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/common/panic-log/Cargo.toml b/common/panic-log/Cargo.toml index 4129601..84ca06a 100644 --- a/common/panic-log/Cargo.toml +++ b/common/panic-log/Cargo.toml @@ -7,4 +7,20 @@ version = "0.0.0" [dependencies] cortex-m = "0.6.4" -log = "0.4.8" +defmt = "0.2.1" + + +[features] +# defmt logging levels +default = [ + "defmt-debug", + # "dependency-a/defmt-trace", +] + +# do NOT modify these features +defmt-default = [] +defmt-trace = [] +defmt-debug = [] +defmt-info = [] +defmt-warn = [] +defmt-error = [] \ No newline at end of file diff --git a/common/panic-log/src/lib.rs b/common/panic-log/src/lib.rs index 5a08462..70f0b89 100644 --- a/common/panic-log/src/lib.rs +++ b/common/panic-log/src/lib.rs @@ -6,7 +6,7 @@ use cortex_m::asm; #[panic_handler] fn panic(info: &PanicInfo) -> ! { - log::error!("{}", info); + defmt::error!("{}", defmt::Debug2Format(&info)); // abort instruction: triggers a HardFault exception which causes probe-run to exit asm::udf()