Refactor async logging to synchronous; improve error handling consistency across modules.
This commit is contained in:
@@ -3,7 +3,7 @@ use alloc::vec::Vec;
|
||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::blocking_mutex::Mutex as BlockingMutex;
|
||||
use embassy_sync::mutex::Mutex;
|
||||
use log::{LevelFilter, Log, Metadata, Record};
|
||||
use log::{error, LevelFilter, Log, Metadata, Record};
|
||||
|
||||
pub struct InterceptorLogger {
|
||||
// Async mutex for start/stop capture from async context
|
||||
@@ -34,9 +34,13 @@ impl InterceptorLogger {
|
||||
}
|
||||
|
||||
pub fn init(&'static self) {
|
||||
log::set_logger(self)
|
||||
.map(|()| log::set_max_level(LevelFilter::Info))
|
||||
.unwrap();
|
||||
match log::set_logger(self)
|
||||
.map(|()| log::set_max_level(LevelFilter::Info)) {
|
||||
Ok(()) => {}
|
||||
Err(e) => {
|
||||
error!("Logger already set: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user