added some functionality to the loggers filter

This commit is contained in:
Christoph J. Scherr 2023-08-08 14:11:49 +02:00
commit 223a5ad508
2 changed files with 7 additions and 0 deletions

View File

@ -28,6 +28,7 @@ pub mod args;
use args::*; use args::*;
//// CONSTANTS ///////////////////////////////////////////////////////////////////////////////////// //// CONSTANTS /////////////////////////////////////////////////////////////////////////////////////
#[allow(dead_code)]
const EXIT_SUCCESS: i32 = 0; const EXIT_SUCCESS: i32 = 0;
const EXIT_FAILURE_USAGE: i32 = 1; const EXIT_FAILURE_USAGE: i32 = 1;

View File

@ -109,9 +109,15 @@ impl Logger {
} else { } else {
let filter = tracing_subscriber::filter::FilterFn::new(|metadata| { let filter = tracing_subscriber::filter::FilterFn::new(|metadata| {
let mut filter = false; let mut filter = false;
// if it's this lib, continue
filter |= metadata.target().contains(env!("CARGO_PKG_NAME")); filter |= metadata.target().contains(env!("CARGO_PKG_NAME"));
filter |= metadata.target().contains("pt"); filter |= metadata.target().contains("pt");
// if it's another crate, only show above debug
// FIXME, this is not the behaviour I want for a real release
filter |= metadata.level() > &Level::DEBUG;
filter filter
}); });