Do not print logging output if DEBUG < 1
This commit is contained in:
parent
c6b43b2c48
commit
bed78e0d7b
1 changed files with 6 additions and 4 deletions
10
src/dev.rs
10
src/dev.rs
|
|
@ -38,11 +38,11 @@ macro_rules! log {
|
||||||
path_vec.get(path_vec.len().saturating_sub(2)),
|
path_vec.get(path_vec.len().saturating_sub(2)),
|
||||||
path_vec.get(path_vec.len().saturating_sub(3)),
|
path_vec.get(path_vec.len().saturating_sub(3)),
|
||||||
) {
|
) {
|
||||||
display_path = if level > 3 {
|
display_path = if level > 4 {
|
||||||
format!("{} -> {}", trace, path.clone())
|
format!("{} -> {}", trace, path.clone())
|
||||||
} else if level > 2 {
|
} else if level > 3 {
|
||||||
path.clone()
|
path.clone()
|
||||||
} else if level > 0 {
|
} else if level > 1 {
|
||||||
format!("{third_to_last}::{second_to_last}::{last}")
|
format!("{third_to_last}::{second_to_last}::{last}")
|
||||||
} else {
|
} else {
|
||||||
format!("{second_to_last}::{last}")
|
format!("{second_to_last}::{last}")
|
||||||
|
|
@ -55,7 +55,9 @@ macro_rules! log {
|
||||||
let filter = std::env::var("DEBUG_FILTER").unwrap_or("any".to_string());
|
let filter = std::env::var("DEBUG_FILTER").unwrap_or("any".to_string());
|
||||||
|
|
||||||
if $crate::dev::SKIP_PATHS.iter().all(|&s| !trace.contains(s)) &&
|
if $crate::dev::SKIP_PATHS.iter().all(|&s| !trace.contains(s)) &&
|
||||||
(filter == "any" || filter.is_empty() || path.contains(&filter)) {
|
(filter == "any" || filter.is_empty() || path.contains(&filter)) &&
|
||||||
|
level > 0
|
||||||
|
{
|
||||||
$crate::dev::elog(&display_path, &format!($fmt $(, $($arg)+ )?));
|
$crate::dev::elog(&display_path, &format!($fmt $(, $($arg)+ )?));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue