Skip to content

Commit

Permalink
feat: remove unnecessary logs (#844)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Nov 13, 2024
1 parent 99e3080 commit fbca189
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 38 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"] }
Expand Down
11 changes: 6 additions & 5 deletions dragonfly-client-backend/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<super::HeadResponse> {
info!(
debug!(
"head request {} {}: {:?}",
request.task_id, request.url, request.http_header
);
Expand Down Expand Up @@ -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
);
Expand All @@ -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<super::GetResponse<super::Body>> {
info!(
debug!(
"get request {} {} {}: {:?}",
request.task_id, request.piece_id, request.url, request.http_header
);
Expand Down Expand Up @@ -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
);
Expand Down
8 changes: 4 additions & 4 deletions dragonfly-client-backend/src/object_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<super::HeadResponse> {
info!(
debug!(
"head request {} {}: {:?}",
request.task_id, request.url, request.http_header
);
Expand Down Expand Up @@ -551,7 +551,7 @@ impl crate::Backend for ObjectStorage {
})
})?;

info!(
debug!(
"head response {} {}: {}",
request.task_id,
request.url,
Expand All @@ -574,7 +574,7 @@ impl crate::Backend for ObjectStorage {
&self,
request: super::GetRequest,
) -> ClientResult<super::GetResponse<super::Body>> {
info!(
debug!(
"get request {} {}: {:?}",
request.piece_id, request.url, request.http_header
);
Expand Down
4 changes: 2 additions & 2 deletions dragonfly-client-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion dragonfly-client-util/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn hashmap_to_headermap(header: &HashMap<String, String>) -> Result<HeaderMa
let mut headermap = HeaderMap::with_capacity(header.len());
for (k, v) in header {
let name = HeaderName::from_bytes(k.as_bytes()).or_err(ErrorType::ParseError)?;
let value = HeaderValue::from_str(v).or_err(ErrorType::ParseError)?;
let value = HeaderValue::from_bytes(v.as_bytes()).or_err(ErrorType::ParseError)?;
headermap.insert(name, value);
}

Expand Down
4 changes: 2 additions & 2 deletions dragonfly-client/src/grpc/dfdaemon_download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ use tonic::{
Code, Request, Response, Status,
};
use tower::service_fn;
use tracing::{error, info, instrument, Instrument, Span};
use tracing::{debug, error, info, instrument, Instrument, Span};

/// DfdaemonDownloadServer is the grpc unix server of the download.
pub struct DfdaemonDownloadServer {
Expand Down Expand Up @@ -176,7 +176,7 @@ impl DfdaemonDownload for DfdaemonDownloadServerHandler {
&self,
request: Request<DownloadTaskRequest>,
) -> Result<Response<Self::DownloadTaskStream>, Status> {
info!("download task in download server");
debug!("download task in download server");

// Record the start time.
let start_time = Instant::now();
Expand Down
4 changes: 2 additions & 2 deletions dragonfly-client/src/grpc/dfdaemon_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -172,7 +172,7 @@ impl DfdaemonUpload for DfdaemonUploadServerHandler {
&self,
request: Request<DownloadTaskRequest>,
) -> Result<Response<Self::DownloadTaskStream>, Status> {
info!("download task in upload server");
debug!("download task in upload server");

// Record the start time.
let start_time = Instant::now();
Expand Down
8 changes: 4 additions & 4 deletions dragonfly-client/src/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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| {
Expand Down
4 changes: 2 additions & 2 deletions dragonfly-client/src/resource/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down Expand Up @@ -280,7 +280,7 @@ impl Task {
return Err(err);
}
};
info!(
debug!(
"interested pieces: {:?}",
interested_pieces
.iter()
Expand Down

0 comments on commit fbca189

Please sign in to comment.