From fbca1897c608240d8282fdf11218202f10eee401 Mon Sep 17 00:00:00 2001 From: Gaius Date: Wed, 13 Nov 2024 22:48:41 +0800 Subject: [PATCH] feat: remove unnecessary logs (#844) Signed-off-by: Gaius --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 16 ++++++++-------- dragonfly-client-backend/src/http.rs | 11 ++++++----- dragonfly-client-backend/src/object_storage.rs | 8 ++++---- dragonfly-client-storage/src/lib.rs | 4 ++-- dragonfly-client-util/src/http/mod.rs | 2 +- dragonfly-client/src/grpc/dfdaemon_download.rs | 4 ++-- dragonfly-client/src/grpc/dfdaemon_upload.rs | 4 ++-- dragonfly-client/src/proxy/mod.rs | 8 ++++---- dragonfly-client/src/resource/task.rs | 4 ++-- 10 files changed, 39 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 104c8400..c53612c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -865,7 +865,7 @@ dependencies = [ [[package]] name = "dragonfly-client" -version = "0.1.116" +version = "0.1.117" dependencies = [ "anyhow", "blake3", @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dragonfly-client-backend" -version = "0.1.116" +version = "0.1.117" dependencies = [ "dragonfly-api", "dragonfly-client-core", @@ -965,7 +965,7 @@ dependencies = [ [[package]] name = "dragonfly-client-config" -version = "0.1.116" +version = "0.1.117" dependencies = [ "bytesize", "bytesize-serde", @@ -991,7 +991,7 @@ dependencies = [ [[package]] name = "dragonfly-client-core" -version = "0.1.116" +version = "0.1.117" dependencies = [ "headers 0.4.0", "hyper 1.5.0", @@ -1009,7 +1009,7 @@ dependencies = [ [[package]] name = "dragonfly-client-init" -version = "0.1.116" +version = "0.1.117" dependencies = [ "anyhow", "clap", @@ -1026,7 +1026,7 @@ dependencies = [ [[package]] name = "dragonfly-client-storage" -version = "0.1.116" +version = "0.1.117" dependencies = [ "base16ct", "bincode", @@ -1051,7 +1051,7 @@ dependencies = [ [[package]] name = "dragonfly-client-util" -version = "0.1.116" +version = "0.1.117" dependencies = [ "base16ct", "base64 0.22.1", @@ -1423,7 +1423,7 @@ dependencies = [ [[package]] name = "hdfs" -version = "0.1.116" +version = "0.1.117" dependencies = [ "dragonfly-client-backend", "dragonfly-client-core", diff --git a/Cargo.toml b/Cargo.toml index 9ed3a81d..64c655ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ members = [ ] [workspace.package] -version = "0.1.116" +version = "0.1.117" authors = ["The Dragonfly Developers"] homepage = "https://d7y.io/" repository = "https://github.com/dragonflyoss/client.git" @@ -22,13 +22,13 @@ readme = "README.md" edition = "2021" [workspace.dependencies] -dragonfly-client = { path = "dragonfly-client", version = "0.1.116" } -dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.116" } -dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.116" } -dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.116" } -dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.116" } -dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.116" } -dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.116" } +dragonfly-client = { path = "dragonfly-client", version = "0.1.117" } +dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.117" } +dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.117" } +dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.117" } +dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.117" } +dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.117" } +dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.117" } thiserror = "1.0" dragonfly-api = "=2.0.169" reqwest = { version = "0.12.4", features = ["stream", "native-tls", "default-tls", "rustls-tls"] } diff --git a/dragonfly-client-backend/src/http.rs b/dragonfly-client-backend/src/http.rs index cf595db1..8447aa05 100644 --- a/dragonfly-client-backend/src/http.rs +++ b/dragonfly-client-backend/src/http.rs @@ -20,7 +20,7 @@ use futures::TryStreamExt; use rustls_pki_types::CertificateDer; use std::io::{Error as IOError, ErrorKind}; use tokio_util::io::StreamReader; -use tracing::{error, info, instrument}; +use tracing::{debug, error, instrument}; /// HTTP is the HTTP backend. pub struct HTTP { @@ -77,7 +77,7 @@ impl super::Backend for HTTP { /// head gets the header of the request. #[instrument(skip_all)] async fn head(&self, request: super::HeadRequest) -> Result { - info!( + debug!( "head request {} {}: {:?}", request.task_id, request.url, request.http_header ); @@ -106,7 +106,7 @@ impl super::Backend for HTTP { let header = response.headers().clone(); let status_code = response.status(); - info!( + debug!( "head response {} {}: {:?} {:?}", request.task_id, request.url, status_code, header ); @@ -124,7 +124,7 @@ impl super::Backend for HTTP { /// get gets the content of the request. #[instrument(skip_all)] async fn get(&self, request: super::GetRequest) -> Result> { - info!( + debug!( "get request {} {} {}: {:?}", request.task_id, request.piece_id, request.url, request.http_header ); @@ -153,7 +153,8 @@ impl super::Backend for HTTP { .bytes_stream() .map_err(|err| IOError::new(ErrorKind::Other, err)), )); - info!( + + debug!( "get response {} {}: {:?} {:?}", request.task_id, request.piece_id, status_code, header ); diff --git a/dragonfly-client-backend/src/object_storage.rs b/dragonfly-client-backend/src/object_storage.rs index 1654e82b..0864e249 100644 --- a/dragonfly-client-backend/src/object_storage.rs +++ b/dragonfly-client-backend/src/object_storage.rs @@ -24,7 +24,7 @@ use std::result::Result; use std::str::FromStr; use std::time::Duration; use tokio_util::io::StreamReader; -use tracing::{error, info, instrument}; +use tracing::{debug, error, instrument}; use url::Url; /// Scheme is the scheme of the object storage. @@ -485,7 +485,7 @@ impl crate::Backend for ObjectStorage { /// head gets the header of the request. #[instrument(skip_all)] async fn head(&self, request: super::HeadRequest) -> ClientResult { - info!( + debug!( "head request {} {}: {:?}", request.task_id, request.url, request.http_header ); @@ -551,7 +551,7 @@ impl crate::Backend for ObjectStorage { }) })?; - info!( + debug!( "head response {} {}: {}", request.task_id, request.url, @@ -574,7 +574,7 @@ impl crate::Backend for ObjectStorage { &self, request: super::GetRequest, ) -> ClientResult> { - info!( + debug!( "get request {} {}: {:?}", request.piece_id, request.url, request.http_header ); diff --git a/dragonfly-client-storage/src/lib.rs b/dragonfly-client-storage/src/lib.rs index 62a94297..0dce7a1a 100644 --- a/dragonfly-client-storage/src/lib.rs +++ b/dragonfly-client-storage/src/lib.rs @@ -24,7 +24,7 @@ use std::path::PathBuf; use std::sync::Arc; use std::time::Duration; use tokio::io::AsyncRead; -use tracing::{error, info, instrument}; +use tracing::{debug, error, info, instrument}; pub mod content; pub mod metadata; @@ -454,7 +454,7 @@ impl Storage { } if wait_for_piece_count > 0 { - info!("wait piece finished"); + debug!("wait piece finished"); } wait_for_piece_count += 1; } diff --git a/dragonfly-client-util/src/http/mod.rs b/dragonfly-client-util/src/http/mod.rs index 9951e26f..20af82c9 100644 --- a/dragonfly-client-util/src/http/mod.rs +++ b/dragonfly-client-util/src/http/mod.rs @@ -44,7 +44,7 @@ pub fn hashmap_to_headermap(header: &HashMap) -> Result, ) -> Result, Status> { - info!("download task in download server"); + debug!("download task in download server"); // Record the start time. let start_time = Instant::now(); diff --git a/dragonfly-client/src/grpc/dfdaemon_upload.rs b/dragonfly-client/src/grpc/dfdaemon_upload.rs index d3af8d41..03a8e2fb 100644 --- a/dragonfly-client/src/grpc/dfdaemon_upload.rs +++ b/dragonfly-client/src/grpc/dfdaemon_upload.rs @@ -51,7 +51,7 @@ use tonic::{ transport::{Channel, Server}, Code, Request, Response, Status, }; -use tracing::{error, info, instrument, Instrument, Span}; +use tracing::{debug, error, info, instrument, Instrument, Span}; use url::Url; /// DfdaemonUploadServer is the grpc server of the upload. @@ -172,7 +172,7 @@ impl DfdaemonUpload for DfdaemonUploadServerHandler { &self, request: Request, ) -> Result, Status> { - info!("download task in upload server"); + debug!("download task in upload server"); // Record the start time. let start_time = Instant::now(); diff --git a/dragonfly-client/src/proxy/mod.rs b/dragonfly-client/src/proxy/mod.rs index fa158f8b..b5f32220 100644 --- a/dragonfly-client/src/proxy/mod.rs +++ b/dragonfly-client/src/proxy/mod.rs @@ -59,7 +59,7 @@ use tokio::sync::mpsc; use tokio::time::sleep; use tokio_rustls::TlsAcceptor; use tokio_util::io::ReaderStream; -use tracing::{error, info, instrument, Span}; +use tracing::{debug, error, info, instrument, Span}; pub mod header; @@ -156,7 +156,7 @@ impl Proxy { // Spawn a task to handle the connection. let io = TokioIo::new(tcp); - info!("accepted connection from {}", remote_address); + debug!("accepted connection from {}", remote_address); let config = self.config.clone(); let task = self.task.clone(); @@ -722,7 +722,7 @@ async fn proxy_by_dfdaemon( // Send the none response to the client, if the first piece is received. if !initialized { - info!("first piece received, send response"); + debug!("first piece received, send response"); sender.send(None).await.unwrap_or_default(); initialized = true; } @@ -768,7 +768,7 @@ async fn proxy_by_dfdaemon( while let Some(piece_reader) = finished_piece_readers.get_mut(&need_piece_number) { - info!("copy piece {} to stream", need_piece_number); + debug!("copy piece {} to stream", need_piece_number); if let Err(err) = tokio::io::copy(piece_reader, &mut writer).await { error!("download piece reader error: {}", err); writer.shutdown().await.unwrap_or_else(|err| { diff --git a/dragonfly-client/src/resource/task.rs b/dragonfly-client/src/resource/task.rs index d85a534f..80402b9f 100644 --- a/dragonfly-client/src/resource/task.rs +++ b/dragonfly-client/src/resource/task.rs @@ -60,7 +60,7 @@ use tokio::task::JoinSet; use tokio::time::sleep; use tokio_stream::{wrappers::ReceiverStream, StreamExt}; use tonic::{Request, Status}; -use tracing::{error, info, instrument, Instrument}; +use tracing::{debug, error, info, instrument, Instrument}; use super::*; @@ -280,7 +280,7 @@ impl Task { return Err(err); } }; - info!( + debug!( "interested pieces: {:?}", interested_pieces .iter()