Add tracing and restructure the Cargo.tomls

This commit is contained in:
Lennart
2024-10-04 16:30:59 +02:00
parent 12e4e42c7c
commit c14eddb0b6
12 changed files with 892 additions and 123 deletions

View File

@@ -1,23 +1,21 @@
[package]
name = "rustical_dav"
version = "0.1.0"
edition = "2021"
version.workspace = true
edition.workspace = true
[dependencies]
actix-web = "4.9"
anyhow = "1.0"
async-trait = "0.1"
futures-util = "0.3"
quick-xml = { version = "0.36", features = [
"serde",
"serde-types",
"serialize",
] }
rustical_store = { path = "../store/" }
serde = { version = "1.0", features = ["derive"] }
strum = "0.26"
itertools = "0.13"
thiserror = "1.0"
roxmltree = "0.20"
log = "0.4"
derive_more = { version = "1.0.0", features = ["deref"] }
actix-web = { workspace = true }
anyhow = { workspace = true }
async-trait = { workspace = true }
futures-util = { workspace = true }
quick-xml = { workspace = true }
rustical_store = { workspace = true }
serde = { workspace = true }
strum = { workspace = true }
thiserror = { workspace = true }
roxmltree = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
derive_more = { workspace = true }
tracing = { workspace = true }
tracing-actix-web = { workspace = true }

View File

@@ -8,9 +8,10 @@ use crate::Error;
use actix_web::web::Path;
use actix_web::HttpRequest;
use derive_more::derive::Deref;
use log::debug;
use rustical_store::auth::User;
use serde::Deserialize;
use tracing::instrument;
use tracing_actix_web::RootSpan;
// This is not the final place for this struct
#[derive(Deref)]
@@ -38,12 +39,14 @@ struct PropfindElement {
prop: PropfindType,
}
#[instrument(parent = root_span.id(), skip(path_components, req, root_span))]
pub async fn route_propfind<R: ResourceService>(
path_components: Path<R::PathComponents>,
body: String,
req: HttpRequest,
user: User,
depth: Depth,
root_span: RootSpan,
) -> Result<
MultistatusElement<
PropstatWrapper<<R::Resource as Resource>::Prop>,
@@ -51,8 +54,6 @@ pub async fn route_propfind<R: ResourceService>(
>,
R::Error,
> {
debug!("{body}");
let resource_service = R::new(&req, path_components.into_inner()).await?;
// A request body is optional. If empty we MUST return all props

View File

@@ -94,7 +94,7 @@ impl<T1: Serialize, T2: Serialize> Responder for MultistatusElement<T1, T2> {
if let Err(err) = self.serialize(ser) {
return crate::Error::from(err).error_response();
}
debug!("Return multistatus:\n{output}");
// debug!("Return multistatus:\n{output}");
HttpResponse::MultiStatus()
.content_type(ContentType::xml())