diff options
author | Brian Cully <bjc@kublai.com> | 2019-07-25 17:20:31 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-07-25 17:20:31 -0400 |
commit | 1ec7af966fc0be5353e9c588b631a3e2618e2080 (patch) | |
tree | 4494cb3d9b1361af3254b261b15ec2a1f0662753 /app | |
parent | 49d07d64b338c1913e83816941a24ae35df42ee9 (diff) | |
download | samd21-demo-1ec7af966fc0be5353e9c588b631a3e2618e2080.tar.gz samd21-demo-1ec7af966fc0be5353e9c588b631a3e2618e2080.zip |
Update log levels.
Diffstat (limited to 'app')
-rw-r--r-- | app/Cargo.toml | 2 | ||||
-rw-r--r-- | app/src/logger.rs | 4 | ||||
-rwxr-xr-x | app/src/main.rs | 14 |
3 files changed, 10 insertions, 10 deletions
diff --git a/app/Cargo.toml b/app/Cargo.toml index 09900f9..1bf5ab8 100644 --- a/app/Cargo.toml +++ b/app/Cargo.toml @@ -21,7 +21,7 @@ nb = "~0.1" cortex-m = "~0.6" cortex-m-rt = "~0.6" embedded-hal = "~0.2" -log = "~0.4" +log = { version = "~0.4", features = ["max_level_trace", "release_max_level_warn"] } [features] default = ["cortex-m/const-fn"] diff --git a/app/src/logger.rs b/app/src/logger.rs index 140eebe..5ef08f7 100644 --- a/app/src/logger.rs +++ b/app/src/logger.rs @@ -3,7 +3,7 @@ use rb::{Reader, RingBuffer, Writer}; use core::cell::UnsafeCell; use core::fmt::{self, Write}; use embedded_hal::{digital::v2::OutputPin, serial}; -use log::{Level, Metadata, Record}; +use log::{Metadata, Record}; use trinket_m0::{ gpio::{Pa6, Pa7, PfD}, sercom::{Sercom0Pad2, Sercom0Pad3, UART0}, @@ -83,7 +83,7 @@ where L: OutputPin + Send + Sync, { fn enabled(&self, metadata: &Metadata) -> bool { - metadata.level() <= Level::Info + metadata.level() <= log::max_level() } fn log(&self, record: &Record) { diff --git a/app/src/main.rs b/app/src/main.rs index 792f339..d091a9e 100755 --- a/app/src/main.rs +++ b/app/src/main.rs @@ -16,7 +16,7 @@ use clint::HandlerArray; use cortex_m::asm::wfi; use cortex_m_rt::{entry, exception, ExceptionFrame}; use embedded_hal::digital::v2::OutputPin; -use log::{info, LevelFilter}; +use log::{debug, info, LevelFilter}; use smart_leds::colors; use smart_leds_trait::SmartLedsWrite; use trinket_m0::{ @@ -130,7 +130,7 @@ fn main() -> ! { let tick = rtc::millis(); if tick >= last_tick + 1_024 { last_tick = tick; - // info!("{}: tick\r\n", rtc::millis()); + // trace!("{}: tick\r\n", rtc::millis()); } usb_host.task(); @@ -177,7 +177,7 @@ fn DefaultHandler(interrupt: i16) { let red_led: &mut Pa10<Output<OpenDrain>> = unsafe { core::mem::transmute(LED) }; red_led.set_high().ok(); - info!("*** Default Handler: {} ***", interrupt); + debug!("*** Default Handler: {} ***", interrupt); } #[exception] @@ -185,7 +185,7 @@ fn NonMaskableInt() { let red_led: &mut Pa10<Output<OpenDrain>> = unsafe { core::mem::transmute(LED) }; red_led.set_high().ok(); - info!("+++ NonMaskableInt +++"); + debug!("+++ NonMaskableInt +++"); } #[exception] @@ -193,7 +193,7 @@ fn SVCall() { let red_led: &mut Pa10<Output<OpenDrain>> = unsafe { core::mem::transmute(LED) }; red_led.set_high().ok(); - info!("+++ SVCall +++"); + debug!("+++ SVCall +++"); } #[exception] @@ -201,7 +201,7 @@ fn PendSV() { let red_led: &mut Pa10<Output<OpenDrain>> = unsafe { core::mem::transmute(LED) }; red_led.set_high().ok(); - info!("+++ PendSV +++"); + debug!("+++ PendSV +++"); } #[exception] @@ -209,7 +209,7 @@ fn SysTick() { let red_led: &mut Pa10<Output<OpenDrain>> = unsafe { core::mem::transmute(LED) }; red_led.set_high().ok(); - info!("+++ SysTick +++"); + debug!("+++ SysTick +++"); } #[interrupt] |