Log records uniformly use tracing

This commit is contained in:
houseme
2025-04-01 23:27:48 +08:00
parent 28edca1b63
commit de0e9bee20
3 changed files with 22 additions and 23 deletions
Generated
-1
View File
@@ -6680,7 +6680,6 @@ dependencies = [
"lazy_static", "lazy_static",
"local-ip-address", "local-ip-address",
"lock", "lock",
"log",
"madmin", "madmin",
"matchit 0.8.6", "matchit 0.8.6",
"mime", "mime",
+1 -1
View File
@@ -16,7 +16,7 @@ workspace = true
[dependencies] [dependencies]
madmin.workspace = true madmin.workspace = true
log.workspace = true #log.workspace = true
async-trait.workspace = true async-trait.workspace = true
bytes.workspace = true bytes.workspace = true
clap.workspace = true clap.workspace = true
+21 -21
View File
@@ -46,7 +46,6 @@ use futures::pin_mut;
use futures::{Stream, StreamExt}; use futures::{Stream, StreamExt};
use http::HeaderMap; use http::HeaderMap;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use log::warn;
use policy::auth; use policy::auth;
use policy::policy::action::Action; use policy::policy::action::Action;
use policy::policy::action::S3Action; use policy::policy::action::S3Action;
@@ -70,6 +69,7 @@ use tokio_util::io::StreamReader;
use tracing::debug; use tracing::debug;
use tracing::error; use tracing::error;
use tracing::info; use tracing::info;
use tracing::warn;
use transform_stream::AsyncTryStream; use transform_stream::AsyncTryStream;
use uuid::Uuid; use uuid::Uuid;
@@ -230,7 +230,7 @@ impl S3 for FS {
#[tracing::instrument(level = "debug", skip(self, req))] #[tracing::instrument(level = "debug", skip(self, req))]
async fn delete_bucket(&self, req: S3Request<DeleteBucketInput>) -> S3Result<S3Response<DeleteBucketOutput>> { async fn delete_bucket(&self, req: S3Request<DeleteBucketInput>) -> S3Result<S3Response<DeleteBucketOutput>> {
let input = req.input; let input = req.input;
// TODO: DeleteBucketInput 没有force参数? // TODO: DeleteBucketInput 没有 force 参数?
let Some(store) = new_object_layer_fn() else { let Some(store) = new_object_layer_fn() else {
return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string())); return Err(S3Error::with_message(S3ErrorCode::InternalError, "Not init".to_string()));
}; };
@@ -586,8 +586,8 @@ impl S3 for FS {
.await .await
.is_ok() .is_ok()
|| authorize_request(&mut req, Action::S3Action(S3Action::GetBucketLocationAction)) || authorize_request(&mut req, Action::S3Action(S3Action::GetBucketLocationAction))
.await .await
.is_ok() .is_ok()
}) })
}); });
} }
@@ -1256,7 +1256,7 @@ impl S3 for FS {
conditions: &conditions, conditions: &conditions,
object: "", object: "",
}) })
.await; .await;
let write_olny = PolicySys::is_allowed(&BucketPolicyArgs { let write_olny = PolicySys::is_allowed(&BucketPolicyArgs {
bucket: &bucket, bucket: &bucket,
@@ -1267,7 +1267,7 @@ impl S3 for FS {
conditions: &conditions, conditions: &conditions,
object: "", object: "",
}) })
.await; .await;
let is_public = read_olny && write_olny; let is_public = read_olny && write_olny;
@@ -1680,11 +1680,11 @@ impl S3 for FS {
// TODO: valid target list // TODO: valid target list
if let Some(NotificationConfiguration { if let Some(NotificationConfiguration {
event_bridge_configuration, event_bridge_configuration,
lambda_function_configurations, lambda_function_configurations,
queue_configurations, queue_configurations,
topic_configurations, topic_configurations,
}) = has_notification_config }) = has_notification_config
{ {
Ok(S3Response::new(GetBucketNotificationConfigurationOutput { Ok(S3Response::new(GetBucketNotificationConfigurationOutput {
event_bridge_configuration, event_bridge_configuration,
@@ -1785,10 +1785,10 @@ impl S3 for FS {
// //
!gs.is_empty() !gs.is_empty()
&& gs.first().is_some_and(|g| { && gs.first().is_some_and(|g| {
g.to_owned() g.to_owned()
.permission .permission
.is_some_and(|p| p.as_str() == Permission::FULL_CONTROL) .is_some_and(|p| p.as_str() == Permission::FULL_CONTROL)
}) })
}) })
}); });
@@ -1855,10 +1855,10 @@ impl S3 for FS {
// //
!gs.is_empty() !gs.is_empty()
&& gs.first().is_some_and(|g| { && gs.first().is_some_and(|g| {
g.to_owned() g.to_owned()
.permission .permission
.is_some_and(|p| p.as_str() == Permission::FULL_CONTROL) .is_some_and(|p| p.as_str() == Permission::FULL_CONTROL)
}) })
}) })
}); });
@@ -1934,9 +1934,9 @@ impl S3 for FS {
} }
#[allow(dead_code)] #[allow(dead_code)]
pub fn bytes_stream<S, E>(stream: S, content_length: usize) -> impl Stream<Item = Result<Bytes, E>> + Send + 'static pub fn bytes_stream<S, E>(stream: S, content_length: usize) -> impl Stream<Item=Result<Bytes, E>> + Send + 'static
where where
S: Stream<Item = Result<Bytes, E>> + Send + 'static, S: Stream<Item=Result<Bytes, E>> + Send + 'static,
E: Send + 'static, E: Send + 'static,
{ {
AsyncTryStream::<Bytes, E, _>::new(|mut y| async move { AsyncTryStream::<Bytes, E, _>::new(|mut y| async move {