From 6b44c1abf25f16b09a021bc423bbdca7e5f71cc7 Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Thu, 26 Sep 2024 15:04:36 -0400 Subject: [PATCH] chore(oauth): add additional logging to login routine --- src/oauth.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/oauth.rs b/src/oauth.rs index 8173fa5..3648feb 100644 --- a/src/oauth.rs +++ b/src/oauth.rs @@ -91,6 +91,8 @@ impl Oauth { // Build request let request = builder.body(body).unwrap(); + trace!("Sending token request..."); + // Send request let client: client::Client<_, Body> = CLIENT.clone(); let resp = client.request(request).await.ok()?; @@ -109,10 +111,14 @@ impl Oauth { self.headers_map.insert("x-reddit-session".to_owned(), header.to_str().ok()?.to_string()); } + trace!("Serializing response..."); + // Serialize response let body_bytes = hyper::body::to_bytes(resp.into_body()).await.ok()?; let json: serde_json::Value = serde_json::from_slice(&body_bytes).ok()?; + trace!("Accessing relevant fields..."); + // Save token and expiry self.token = json.get("access_token")?.as_str()?.to_string(); self.expires_in = json.get("expires_in")?.as_u64()?;