feat: Use info! for progress logging

Replaces existing progress_bar.println()
This commit is contained in:
quexeky
2026-01-25 22:32:23 +11:00
parent bb3280cedf
commit 820c1b06f9
7 changed files with 9 additions and 16 deletions
+2 -4
View File
@@ -2,10 +2,7 @@ use clap::Subcommand;
use opendal::{Operator, layers::LoggingLayer};
use serde::{Deserialize, Serialize};
use crate::commands::{
connect::s3::{S3Config, S3ConfigCli},
upload::uploadable::OperatorBuilder,
};
use crate::{commands::connect::s3::{S3Config, S3ConfigCli}, operator_builder::OperatorBuilder};
#[derive(Subcommand, Clone)]
pub enum ConfigOptionCli {
@@ -18,6 +15,7 @@ pub enum ConfigOption {
impl ConfigOption {
pub fn build(&self) -> anyhow::Result<Operator> {
Ok(match self {
ConfigOption::S3(s3_config) => s3_config.build()?,
}
+2 -5
View File
@@ -3,11 +3,8 @@ use opendal::Operator;
use serde::{Deserialize, Serialize};
use crate::{
commands::{
connect::{config_option::ConfigOption, configurable::Configure},
upload::uploadable::OperatorBuilder,
},
interactive_variable,
commands::connect::{config_option::ConfigOption, configurable::Configure},
interactive_variable, operator_builder::OperatorBuilder,
};
#[derive(Args, Clone)]
+2 -2
View File
@@ -4,9 +4,9 @@ use crate::{
cli::UploadInfo,
commands::{
connect::config::Config,
upload::{chunk_reader::ChunkReader, uploadable::OperatorBuilder},
upload::chunk_reader::ChunkReader,
},
manifest::generate_manifest,
manifest::generate_manifest, operator_builder::OperatorBuilder,
};
use futures::AsyncWriteExt;
use log::info;
-1
View File
@@ -1,3 +1,2 @@
pub mod chunk_reader;
pub mod interface;
pub mod uploadable;
+1
View File
@@ -9,6 +9,7 @@ mod cli;
mod commands;
mod logging;
mod manifest;
mod operator_builder;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
+2 -1
View File
@@ -2,6 +2,7 @@ use std::{collections::HashMap, path::Path};
use droplet_rs::manifest::{Manifest, generate_manifest_rusty};
use indicatif::{ProgressBar, ProgressStyle};
use log::info;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
@@ -49,7 +50,7 @@ pub async fn generate_manifest(dir: &Path) -> anyhow::Result<Manifest> {
let progress_int = (progress * 100f32).round() as u64;
progress_bar.set_position(progress_int);
},
|log| progress_bar.println(log),
|log| progress_bar.suspend(|| info!("{}", log)),
)
.await
}
@@ -1,8 +1,5 @@
use async_trait::async_trait;
use opendal::Operator;
#[async_trait]
pub trait OperatorBuilder {
fn build(&self) -> anyhow::Result<Operator>;
}