feat: add tracing throughout, HTTP TraceLayer, detailed error logs
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user