mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 14:28:42 +00:00
Improve derbugg logging (#1738)
* Improve derbugg logging Make it more readable Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix excessive logging Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
a2d2c5d85c
commit
4687726c66
10 changed files with 54 additions and 15 deletions
|
@ -12,7 +12,7 @@ use std::{
|
|||
use binstalk_downloader::{download::Download, remote};
|
||||
use compact_str::{format_compact, CompactString, ToCompactString};
|
||||
use tokio::sync::OnceCell;
|
||||
use tracing::instrument;
|
||||
use tracing::{instrument, Level};
|
||||
use url::Url;
|
||||
|
||||
mod common;
|
||||
|
@ -224,7 +224,7 @@ impl GhApiClient {
|
|||
.map_err(|err| err.context("Restful API"))
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self), ret)]
|
||||
#[instrument(skip(self), ret(level = Level::DEBUG))]
|
||||
pub async fn get_repo_info(&self, repo: &GhRepo) -> Result<Option<RepoInfo>, GhApiError> {
|
||||
match self
|
||||
.do_fetch(
|
||||
|
@ -248,7 +248,7 @@ impl GhApiClient {
|
|||
/// Return `Ok(Some(api_artifact_url))` if exists.
|
||||
///
|
||||
/// The returned future is guaranteed to be pointer size.
|
||||
#[instrument(level = "debug", skip(self), ret)]
|
||||
#[instrument(skip(self), ret(level = Level::DEBUG))]
|
||||
pub async fn has_release_artifact(
|
||||
&self,
|
||||
GhReleaseArtifact {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::future::Future;
|
||||
use std::{fmt, future::Future};
|
||||
|
||||
use compact_str::CompactString;
|
||||
use serde::Deserialize;
|
||||
|
@ -20,6 +20,16 @@ pub struct RepoInfo {
|
|||
private: bool,
|
||||
}
|
||||
|
||||
impl fmt::Display for RepoInfo {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"RepoInfo {{ owner: {}, name: {}, is_private: {} }}",
|
||||
self.owner.login, self.name, self.private
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl RepoInfo {
|
||||
#[cfg(test)]
|
||||
pub(crate) fn new(GhRepo { owner, repo }: GhRepo, private: bool) -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue