Skip to content

Commit ce2e308

Browse files
committed
notifications: log directly when downloading files
1 parent 7c27cfd commit ce2e308

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/download/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ async fn download_file_(
102102
use sha2::Digest;
103103
use std::cell::RefCell;
104104

105-
notify_handler(Notification::DownloadingFile(url));
106-
105+
debug!(url = %url, "downloading file");
107106
let hasher = RefCell::new(hasher);
108107

109108
// This callback will write the download to disk and optionally

src/notifications.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::fmt::{self, Display};
22
use std::path::{Path, PathBuf};
33

4-
use url::Url;
5-
64
use crate::dist::TargetTriple;
75
use crate::settings::MetadataVersion;
86
use crate::utils::units;
@@ -15,7 +13,6 @@ pub(crate) enum Notification<'a> {
1513
/// The URL of the download is passed as the last argument, to allow us to track concurrent downloads.
1614
DownloadingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>, &'a str),
1715
RetryingDownload(&'a str),
18-
DownloadingFile(&'a Url),
1916
/// Received the Content-Length of the to-be downloaded data with
2017
/// the respective URL of the download (for tracking concurrent downloads).
2118
DownloadContentLengthReceived(u64, Option<&'a str>),
@@ -63,8 +60,7 @@ impl Notification<'_> {
6360
DownloadingComponent(_, _, _, _) | RetryingDownload(_) => NotificationLevel::Info,
6461
CachedFileChecksumFailed => NotificationLevel::Warn,
6562
SetDefaultBufferSize(_) => NotificationLevel::Trace,
66-
DownloadingFile(_)
67-
| DownloadContentLengthReceived(_, _)
63+
DownloadContentLengthReceived(_, _)
6864
| DownloadDataReceived(_, _)
6965
| DownloadFinished(_)
7066
| DownloadFailed(_)
@@ -110,7 +106,6 @@ impl Display for Notification<'_> {
110106
"using up to {} of RAM to unpack components",
111107
units::Size::new(*size)
112108
),
113-
DownloadingFile(url) => write!(f, "downloading file from: '{url}'"),
114109
DownloadContentLengthReceived(len, _) => write!(f, "download size is: '{len}'"),
115110
DownloadDataReceived(data, _) => write!(f, "received some data of size {}", data.len()),
116111
DownloadFinished(_) => write!(f, "download finished"),

0 commit comments

Comments
 (0)