mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-16 07:36:38 +00:00
Update main::entry
to use UIThread
's logger
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
72cf83bcbc
commit
9e232a4051
1 changed files with 4 additions and 15 deletions
19
src/main.rs
19
src/main.rs
|
@ -10,7 +10,6 @@ use cargo_toml::{Package, Product};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use log::{debug, error, info, warn, LevelFilter};
|
use log::{debug, error, info, warn, LevelFilter};
|
||||||
use miette::{miette, IntoDiagnostic, Result, WrapErr};
|
use miette::{miette, IntoDiagnostic, Result, WrapErr};
|
||||||
use simplelog::{ColorChoice, ConfigBuilder, TermLogger, TerminalMode};
|
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
use tokio::{process::Command, runtime::Runtime, task::JoinError};
|
use tokio::{process::Command, runtime::Runtime, task::JoinError};
|
||||||
|
|
||||||
|
@ -177,21 +176,11 @@ async fn entry() -> Result<()> {
|
||||||
bin_dir: opts.bin_dir.take(),
|
bin_dir: opts.bin_dir.take(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Setup logging
|
let mut uithread = UIThread::new(
|
||||||
let mut log_config = ConfigBuilder::new();
|
!opts.no_confirm,
|
||||||
log_config.add_filter_ignore("hyper".to_string());
|
|
||||||
log_config.add_filter_ignore("reqwest".to_string());
|
|
||||||
log_config.add_filter_ignore("rustls".to_string());
|
|
||||||
log_config.set_location_level(LevelFilter::Off);
|
|
||||||
TermLogger::init(
|
|
||||||
opts.log_level,
|
opts.log_level,
|
||||||
log_config.build(),
|
&["hyper", "reqwest", "rustls"],
|
||||||
TerminalMode::Mixed,
|
);
|
||||||
ColorChoice::Auto,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mut uithread = UIThread::new(!opts.no_confirm);
|
|
||||||
|
|
||||||
// Compute install directory
|
// Compute install directory
|
||||||
let install_path = get_install_path(opts.install_path.as_deref()).ok_or_else(|| {
|
let install_path = get_install_path(opts.install_path.as_deref()).ok_or_else(|| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue