Skip to content

Commit

Permalink
Ignore the environment -- only use the python level
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Nov 25, 2024
1 parent bcc6cf0 commit 27c97f9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions rust/pyo3_util/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use pyo3::{
};
use scopeguard::defer;
use tracing::{subscriber::DefaultGuard, Dispatch, Level};
use tracing_subscriber::{filter::LevelFilter, layer::SubscriberExt, EnvFilter};
use tracing_subscriber::{filter::LevelFilter, layer::SubscriberExt};

/// A useful tool for debugging logging.
#[macro_export]
Expand Down Expand Up @@ -62,13 +62,9 @@ pub fn initialize_logging_in_thread(python_package: &'static str, level: LevelFi
python_package: python_package,
};

let filter = EnvFilter::builder()
.with_default_directive(level.into())
.from_env_lossy();

let dispatch = Dispatch::new(
tracing_subscriber::registry()
.with(filter)
.with(level)
.with(logger_bridge),
);
*g.borrow_mut() = Some(tracing::dispatcher::set_default(&dispatch));
Expand Down

0 comments on commit 27c97f9

Please sign in to comment.