unnecessary log generation
This commit is contained in:
parent
0791f6af41
commit
138172b365
@ -7,7 +7,7 @@ use hyper::header::HeaderValue;
|
||||
use hyper::{body, body::Buf, header, Body, Client, Method, Request, Response, Uri};
|
||||
use hyper_rustls::HttpsConnector;
|
||||
use libflate::gzip;
|
||||
use log::{error, trace, warn};
|
||||
use log::{error, debug, warn};
|
||||
use once_cell::sync::Lazy;
|
||||
use percent_encoding::{percent_encode, CONTROLS};
|
||||
use serde_json::Value;
|
||||
@ -396,7 +396,7 @@ pub async fn json(path: String, quarantine: bool) -> Result<Value, String> {
|
||||
response.headers().get("x-ratelimit-reset").and_then(|val| val.to_str().ok().map(|s| s.to_string())),
|
||||
response.headers().get("x-ratelimit-used").and_then(|val| val.to_str().ok().map(|s| s.to_string())),
|
||||
) {
|
||||
trace!(
|
||||
debug!(
|
||||
"Ratelimit remaining: Header says {remaining}, we have {current_rate_limit}. Resets in {reset}. Rollover: {}. Ratelimit used: {used}",
|
||||
if is_rolling_over { "yes" } else { "no" },
|
||||
);
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
};
|
||||
use base64::{engine::general_purpose, Engine as _};
|
||||
use hyper::{client, Body, Method, Request};
|
||||
use log::{error, info, trace};
|
||||
use log::{error, info, debug, trace};
|
||||
|
||||
use serde_json::json;
|
||||
use tokio::time::{error::Elapsed, timeout};
|
||||
@ -160,7 +160,7 @@ pub async fn force_refresh_token() {
|
||||
return;
|
||||
}
|
||||
|
||||
trace!("Rolling over refresh token. Current rate limit: {}", OAUTH_RATELIMIT_REMAINING.load(Ordering::SeqCst));
|
||||
debug!("Rolling over refresh token. Current rate limit: {}", OAUTH_RATELIMIT_REMAINING.load(Ordering::SeqCst));
|
||||
let new_client = Oauth::new().await;
|
||||
OAUTH_CLIENT.swap(new_client.into());
|
||||
OAUTH_RATELIMIT_REMAINING.store(99, Ordering::SeqCst);
|
||||
|
@ -13,6 +13,7 @@ use rinja::Template;
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
use time::{Duration, OffsetDateTime};
|
||||
use log::trace;
|
||||
|
||||
// STRUCTS
|
||||
#[derive(Template)]
|
||||
@ -461,6 +462,8 @@ async fn subreddit(sub: &str, quarantined: bool) -> Result<Subreddit, String> {
|
||||
// Send a request to the url
|
||||
let res = json(path, quarantined).await?;
|
||||
|
||||
trace!("Subreddit info from r/{} : {}",sub,res["data"]);
|
||||
|
||||
// Metadata regarding the subreddit
|
||||
let members: i64 = res["data"]["subscribers"].as_u64().unwrap_or_default() as i64;
|
||||
let active: i64 = res["data"]["accounts_active"].as_u64().unwrap_or_default() as i64;
|
||||
|
@ -8,6 +8,7 @@ use crate::{config, utils};
|
||||
use hyper::{Body, Request, Response};
|
||||
use rinja::Template;
|
||||
use time::{macros::format_description, OffsetDateTime};
|
||||
use log::trace;
|
||||
|
||||
// STRUCTS
|
||||
#[derive(Template)]
|
||||
@ -111,6 +112,7 @@ async fn user(name: &str) -> Result<User, String> {
|
||||
|
||||
// Send a request to the url
|
||||
json(path, false).await.map(|res| {
|
||||
trace!("User info from r/{} : {}",name,res["data"]);
|
||||
// Grab creation date as unix timestamp
|
||||
let created_unix = res["data"]["created"].as_f64().unwrap_or(0.0).round() as i64;
|
||||
let created = OffsetDateTime::from_unix_timestamp(created_unix).unwrap_or(OffsetDateTime::UNIX_EPOCH);
|
||||
|
Loading…
x
Reference in New Issue
Block a user