Replace use of log with tracing (#527)

Resolved #522

* Add dep tracing v0.1.37 to binstalk
* Use `tracing` instead of `log` for logging in binstalk
* Rm dev dep `env_logger` since `log` is no longer used
* Rm unused dep `log` from binstalk

* Replace use of `log` with `tracing` in crates/bin
* Enable feat std of dep log in crates/bin

* Add dep tracing v0.1.37 to binstalk-downloader
* Replace use of `log` with `tracing` in binstalk-downloader
* Rm unused dep `log` from binstalk-downlaoder


* Wrap `ops::{install, resolve}` in `tracing::instrument`
* Wrap `Download::and_{extract, visit_tar}` in `instrument`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-11-13 19:45:37 +11:00 committed by GitHub
parent 9e80cf0700
commit 4e875874b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 38 additions and 47 deletions

View file

@ -21,7 +21,6 @@ futures-util = { version = "0.3.25", default-features = false, features = ["std"
home = "0.5.4"
itertools = "0.10.5"
jobslot = { version = "0.2.6", features = ["tokio"] }
log = { version = "0.4.17", features = ["std"] }
miette = "5.4.1"
normalize-path = { version = "0.2.0", path = "../normalize-path" }
once_cell = "1.16.0"
@ -33,12 +32,10 @@ thiserror = "1.0.37"
tinytemplate = "1.2.1"
# parking_lot for `tokio::sync::OnceCell::const_new`
tokio = { version = "1.21.2", features = ["rt", "process", "sync", "signal", "parking_lot"], default-features = false }
tracing = "0.1.37"
url = { version = "2.3.1", features = ["serde"] }
xz2 = "0.1.7"
[dev-dependencies]
env_logger = "0.9.3"
[features]
default = ["static", "rustls"]

View file

@ -6,10 +6,10 @@ use std::{
use cargo_toml::Product;
use compact_str::CompactString;
use log::debug;
use normalize_path::NormalizePath;
use serde::Serialize;
use tinytemplate::TinyTemplate;
use tracing::debug;
use crate::{
errors::BinstallError,

View file

@ -2,8 +2,8 @@ use std::path::PathBuf;
use cargo_toml::Manifest;
use crates_io_api::AsyncClient;
use log::debug;
use semver::VersionReq;
use tracing::debug;
use crate::{
errors::BinstallError,

View file

@ -4,8 +4,8 @@ use std::{
};
use cargo_toml::Manifest;
use log::debug;
use normalize_path::NormalizePath;
use tracing::debug;
use super::vfs::Vfs;
use crate::{

View file

@ -1,5 +1,5 @@
use log::debug;
use semver::VersionReq;
use tracing::debug;
use crate::errors::BinstallError;

View file

@ -2,7 +2,6 @@ use std::{path::Path, sync::Arc};
use compact_str::CompactString;
pub use gh_crate_meta::*;
pub use log::debug;
pub use quickinstall::*;
use crate::{

View file

@ -2,11 +2,11 @@ use std::{path::Path, sync::Arc};
use compact_str::{CompactString, ToCompactString};
use futures_util::stream::{FuturesUnordered, StreamExt};
use log::{debug, warn};
use once_cell::sync::OnceCell;
use serde::Serialize;
use strum::IntoEnumIterator;
use tinytemplate::TinyTemplate;
use tracing::{debug, warn};
use url::Url;
use crate::{

View file

@ -1,8 +1,8 @@
use std::{path::Path, sync::Arc};
use compact_str::CompactString;
use log::debug;
use tokio::task::JoinHandle;
use tracing::debug;
use url::Url;
use crate::{

View file

@ -1,7 +1,7 @@
use std::{fs, io, path::Path};
use log::debug;
use tempfile::NamedTempFile;
use tracing::debug;
/// Atomically install a file.
///

View file

@ -1,8 +1,8 @@
use std::{borrow::Cow, env, ffi::OsStr, sync::Arc};
use compact_str::CompactString;
use log::{debug, error, info};
use tokio::{process::Command, task::block_in_place};
use tracing::{debug, error, info, instrument};
use super::{resolve::Resolution, Options};
use crate::{
@ -12,6 +12,7 @@ use crate::{
manifests::crate_info::{CrateInfo, CrateSource},
};
#[instrument(skip_all)]
pub async fn install(
resolution: Resolution,
opts: Arc<Options>,

View file

@ -9,9 +9,9 @@ use std::{
use cargo_toml::{Manifest, Package, Product};
use compact_str::{CompactString, ToCompactString};
use itertools::Itertools;
use log::{debug, info, warn};
use semver::{Version, VersionReq};
use tokio::task::block_in_place;
use tracing::{debug, info, instrument, warn};
use super::Options;
use crate::{
@ -89,6 +89,7 @@ impl Resolution {
}
}
#[instrument(skip_all)]
pub async fn resolve(
opts: Arc<Options>,
crate_name: CrateName,

View file

@ -3,8 +3,6 @@ use cargo_toml::Product;
#[test]
fn parse_meta() {
let _ = env_logger::builder().is_test(true).try_init();
let mut manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
manifest_dir.push_str("/tests/parse-meta.Cargo.toml");