From e40508c8ce125d4df8185d07d2c94ceae0e62479 Mon Sep 17 00:00:00 2001 From: Christoph Herzog Date: Tue, 25 Jun 2024 19:19:02 +0200 Subject: [PATCH] chore: More logging during package downloads --- .../runtime/package_loader/builtin_loader.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/wasix/src/runtime/package_loader/builtin_loader.rs b/lib/wasix/src/runtime/package_loader/builtin_loader.rs index 13867621df9..521b10a89a3 100644 --- a/lib/wasix/src/runtime/package_loader/builtin_loader.rs +++ b/lib/wasix/src/runtime/package_loader/builtin_loader.rs @@ -141,7 +141,7 @@ impl BuiltinPackageLoader { options: Default::default(), }; - tracing::debug!(%request.url, %request.method, "Downloading a webc file"); + tracing::debug!(%request.url, %request.method, "webc_package_download_start"); tracing::trace!(?request.headers); let response = self.client.request(request).await?; @@ -154,15 +154,18 @@ impl BuiltinPackageLoader { "Received a response", ); + let url = &dist.webc; if !response.is_ok() { - let url = &dist.webc; - return Err(crate::runtime::resolver::utils::http_error(&response) - .context(format!("The GET request to \"{url}\" failed"))); + return Err( + crate::runtime::resolver::utils::http_error(&response).context(format!( + "package download failed: GET request to \"{}\" failed with status {}", + url, response.status + )), + ); } - let body = response - .body - .context("The response didn't contain a body")?; + let body = response.body.context("package download failed")?; + tracing::debug!(%url, "package_download_succeeded"); Ok(body.into()) }