Skip to content

Commit

Permalink
Set logger level
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerthox committed Jul 23, 2022
1 parent 24a472b commit 344adf8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ pub mod __macro {
// only set logger if export e8 was found
#[cfg(feature = "log")]
if ARC_INSTANCE.e8.is_some() {
let _ = log::set_boxed_logger(Box::new(WindowLogger::new(name)));
let result = log::set_boxed_logger(Box::new(WindowLogger::new(name)));
if result.is_ok() {
log::set_max_level(log::LevelFilter::Trace);
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion core/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ impl Log for WindowLogger {

fn log(&self, record: &Record) {
// TODO: coloring
let message = format!("{} {}: {}", self.name, record.level(), record.args());
let message = format!(
"{} {}: {}",
self.name,
record.level().to_string().to_lowercase(),
record.args()
);
let _ = log_to_window(message);
}

Expand Down

0 comments on commit 344adf8

Please sign in to comment.