Skip to content

Commit

Permalink
Use tracing crate instead of log
Browse files Browse the repository at this point in the history
  • Loading branch information
deedy5 committed Jan 17, 2025
1 parent de02176 commit 0f1134f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
15 changes: 14 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ crate-type = ["cdylib"]
[dependencies]
pyo3 = { version = "0.23.4", features = ["extension-module", "abi3-py38", "indexmap", "anyhow"] }
anyhow = "1.0.95"
log = "0.4.25"
tracing = { version = "0.1.41", features = ["log-always"] }
pyo3-log = "0.12.1"
rquest = { version = "1.5.5", features = [
"json",
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use tokio::{
runtime::{self, Runtime},
};
use tokio_util::codec::{BytesCodec, FramedRead};
use tracing;

mod response;
use response::Response;
Expand Down Expand Up @@ -405,7 +406,7 @@ impl Client {
let url = resp.url().to_string();
let buf = resp.bytes().await?;

log::info!("response: {} {} {}", url, status_code, buf.len());
tracing::info!("response: {} {} {}", url, status_code, buf.len());
Ok((buf, cookies, headers, status_code, url))
};

Expand Down
5 changes: 3 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use rquest::boring::{
X509,
},
};
use tracing;

/// Loads the CA certificates from venv var PRIMP_CA_BUNDLE or the WebPKI certificate store
pub fn load_ca_certs() -> Option<&'static X509Store> {
Expand All @@ -36,11 +37,11 @@ pub fn load_ca_certs() -> Option<&'static X509Store> {

match CERT_STORE.as_ref() {
Ok(cert_store) => {
log::debug!("Loaded CA certs");
tracing::debug!("Loaded CA certs");
Some(cert_store)
}
Err(err) => {
log::error!("Failed to load CA certs: {:?}", err);
tracing::error!("Failed to load CA certs: {:?}", err);
None
}
}
Expand Down

0 comments on commit 0f1134f

Please sign in to comment.