feat: add tracing throughout, HTTP TraceLayer, detailed error logs

This commit is contained in:
2026-07-11 21:58:58 +02:00
parent e89cf48b34
commit 2b702d88e4
11 changed files with 60 additions and 13 deletions

View File

@@ -9,12 +9,14 @@ use super::deps::ParseTabDeps;
pub async fn execute(deps: &ParseTabDeps, cmd: ParseTabCommand) -> Result<Song, DomainError> {
let html = if let Some(raw_html) = cmd.html {
tracing::debug!("parsing from raw HTML input");
Ok(raw_html)
} else if let Some(source) = cmd.source {
let tab_source = if source.starts_with("file://") {
let path = source.trim_start_matches("file://");
TabSource::File(PathBuf::from(path))
} else {
tracing::debug!(url = source, "fetching tab from URL");
TabSource::Url(source)
};
deps.fetcher
@@ -27,7 +29,17 @@ pub async fn execute(deps: &ParseTabDeps, cmd: ParseTabCommand) -> Result<Song,
))
}?;
deps.parser
let song = deps
.parser
.parse(&html)
.map_err(|e| DomainError::InfrastructureError(e.to_string()))
.map_err(|e| DomainError::InfrastructureError(e.to_string()))?;
tracing::debug!(
title = song.meta.title,
artist = song.meta.artist,
sections = song.sections.len(),
"tab parsed"
);
Ok(song)
}