refactor(log): shorten some logs
This commit is contained in:
parent
0f7eba717e
commit
459a8e1245
@ -339,23 +339,19 @@ pub async fn json(path: String, quarantine: bool) -> Result<Value, String> {
|
|||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
let status = response.status();
|
let status = response.status();
|
||||||
|
|
||||||
// Ratelimit remaining
|
let reset: Option<String> = if let (Some(remaining), Some(reset), Some(used)) = (
|
||||||
if let Some(Ok(remaining)) = response.headers().get("x-ratelimit-remaining").map(|val| val.to_str()) {
|
response.headers().get("x-ratelimit-remaining").and_then(|val| val.to_str().ok().map(|s| s.to_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!(
|
trace!(
|
||||||
"Ratelimit remaining: Header says {remaining}, we have {current_rate_limit}. {}",
|
"Ratelimit remaining: Header says {}, we have {}. Rollover: {}. Ratelimit used: {}",
|
||||||
if is_rolling_over { "Rolling over" } else { "" }
|
remaining,
|
||||||
|
current_rate_limit,
|
||||||
|
if is_rolling_over { "yes" } else { "no" },
|
||||||
|
used,
|
||||||
);
|
);
|
||||||
}
|
Some(reset)
|
||||||
|
|
||||||
// Ratelimit used
|
|
||||||
if let Some(Ok(used)) = response.headers().get("x-ratelimit-used").map(|val| val.to_str()) {
|
|
||||||
trace!("Ratelimit used: {}", used);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ratelimit reset
|
|
||||||
let reset = if let Some(Ok(reset)) = response.headers().get("x-ratelimit-reset").map(|val| val.to_str()) {
|
|
||||||
trace!("Ratelimit reset: {}", reset);
|
|
||||||
Some(reset.to_string())
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user