add more logs

This commit is contained in:
Charlotte 🦝 Delenk 2024-12-09 06:48:52 +01:00
parent 136ee71d72
commit 40eb10bdeb
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
2 changed files with 11 additions and 12 deletions

View file

@ -1,6 +1,7 @@
[workspace]
members = [
"chir-rs-castore", "chir-rs-client",
"chir-rs-castore",
"chir-rs-client",
"chir-rs-config",
"chir-rs-db",
"chir-rs-gemini",
@ -35,7 +36,11 @@ sentry = { version = "0.34.0", default-features = false, features = [
] }
sentry-eyre = "0.2.0"
sentry-tracing = { version = "0.34.0", features = ["backtrace"] }
tokio = { version = "1.41.1", features = ["macros", "rt-multi-thread", "signal"] }
tokio = { version = "1.41.1", features = [
"macros",
"rt-multi-thread",
"signal",
] }
tracing = "0.1.41"
tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
@ -94,9 +99,3 @@ codegen-units = 1
lto = true
debug = "full"
strip = "none"
[profile.dev.package."*"]
opt-level = 2
[profile.dev]
opt-level = 1

View file

@ -9,7 +9,7 @@ use eyre::{eyre, Context as _, OptionExt as _, Result};
use mime_guess::{Mime, MimeGuess};
use reqwest::Body;
use tokio::join;
use tracing::instrument;
use tracing::{info, instrument};
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
@ -92,6 +92,7 @@ async fn upload(url: String, source: impl AsRef<Path>, dest: String) -> Result<(
.body(Body::from(file))
.send()
.await?;
info!("Finished uploading {dest}");
if !res.status().is_success() {
let response = res.bytes().await?;
let response: APIError =
@ -122,11 +123,10 @@ async fn upload_dir(url: String, source: impl AsRef<Path>, dest: String) -> Resu
continue;
}
if file_name_str == "index.html" {
if dest.is_empty() {
upload(url.clone(), ent.path(), "".to_string()).await?;
} else {
if !dest.is_empty() {
upload(url.clone(), ent.path(), format!("{dest}/")).await?;
}
upload(url.clone(), ent.path(), dest.clone()).await?;
}
upload(url.clone(), ent.path(), tgt).await?;
}