Skip to content

Commit

Permalink
refactor: smoother large file download&proxy (#463)
Browse files Browse the repository at this point in the history
* refactor: smoother large file download&proxy

* chore: more msg

* chore: changelog

* chore: fmt

* logs: make get proxy info so user know it working

* refactor: use multiple process bar

* chore: fmt

* fix: allow log&process bar mix

* refactor: per review

* chore: fmt
  • Loading branch information
discord9 authored Dec 12, 2024
1 parent 80e1df8 commit 1e044c5
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- smoother large file download&proxy support (#463)

### Fixed
- When queriying GitHub for the list of releases, retrieve more items (#462)
Expand Down
123 changes: 121 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ rust-version = "1.74.1"

[dependencies]
async-trait = "0.1.83"
bytes = "1.8.0"
clap = { version = "4.5.21", features = ["derive", "env"] }
clap_complete = "4.5.38"
directories = "5.0.1"
env_logger = "0.11.5"
flate2 = "1.0.35"
guess_host_triple = "0.1.4"
indicatif = "0.17.9"
indicatif-log-bridge = "0.2.3"
lazy_static = "1.0"
log = "0.4.22"
miette = { version = "7.3.0", features = ["fancy"] }
regex = "1.11.1"
reqwest = { version = "0.12.9", features = ["blocking", "socks"] }
reqwest = { version = "0.12.9", features = ["blocking", "socks", "stream"] }
retry = "2.0.0"
serde_json = "1.0.133"
strum = { version = "0.26.3", features = ["derive"] }
Expand All @@ -33,6 +37,7 @@ tempfile = "3.14.0"
thiserror = "2.0.3"
tokio = { version = "1.41.1", features = ["full"] }
tokio-retry = "0.3.0"
tokio-stream = "0.1.17"
update-informer = "1.1.0"
xz2 = "0.1.7"
zip = "2.2.1"
Expand Down
12 changes: 10 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ pub mod toolchain;
pub mod logging {
use env_logger::{Builder, Env, WriteStyle};

use crate::toolchain::PROCESS_BARS;

/// Initializes the logger
pub fn initialize_logger(log_level: &str) {
Builder::from_env(Env::default().default_filter_or(log_level))
let logger = Builder::from_env(Env::default().default_filter_or(log_level))
.format(|buf, record| {
use std::io::Write;
writeln!(
Expand All @@ -21,7 +23,13 @@ pub mod logging {
)
})
.write_style(WriteStyle::Always)
.init();
.build();
let level = logger.filter();
// make logging and process bar no longer mixed up
indicatif_log_bridge::LogWrapper::new(PROCESS_BARS.clone(), logger)
.try_init()
.unwrap();
log::set_max_level(level);
}
}

Expand Down
Loading

0 comments on commit 1e044c5

Please sign in to comment.