diff --git a/lakers-python/Cargo.toml b/lakers-python/Cargo.toml index d60b0aa8..dd5d2e85 100644 --- a/lakers-python/Cargo.toml +++ b/lakers-python/Cargo.toml @@ -14,7 +14,7 @@ lakers-ead-authz = { path = "../ead/lakers-ead-authz", features = [ "log" ] } lakers-shared = { path = "../shared", features = ["python-bindings", "quadruple_sizes"] } lakers-crypto = { path = "../crypto", default-features = false, features = ["rustcrypto"] } log = "0.4" -env_logger = "0.9" +pyo3-log = "0.11.0" [dev-dependencies] # We don't need it to build, but it is listed in the manifest Cargo.toml, and diff --git a/lakers-python/src/lib.rs b/lakers-python/src/lib.rs index 89309ef2..d2c4e40f 100644 --- a/lakers-python/src/lib.rs +++ b/lakers-python/src/lib.rs @@ -2,7 +2,6 @@ /// Note that this module is not restricted by no_std. use lakers::*; // use lakers_ead_authz::consts::*; -use env_logger; use lakers_crypto::{default_crypto, CryptoTrait}; use log::trace; use pyo3::wrap_pyfunction; @@ -72,8 +71,10 @@ impl AutoCredential { #[pyo3(name = "lakers")] fn lakers_python(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { // initialize the logger once when the module is imported - if env_logger::try_init().is_ok() { - trace!("lakers-python initialized from Rust side."); + if !pyo3_log::try_init().is_ok() { + // Not logging anything in the successful case as per pyo3_log recommendations: That would + // cache the current logging configuration, which likely changes soon after the imports. + log::error!("lakers-python failed to set up (different logger configured?)"); } m.add_function(wrap_pyfunction!(p256_generate_key_pair, m)?)?;