From f4fac2587d71275568f7c867be8ac1a52370c9dd Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 26 Nov 2024 14:24:21 -0800 Subject: [PATCH] Use self.log rather than logging module directly Using logging.info or .debug directly sets up the root logger, and after that call every single message is duplicated! This showed up only when using the dataverse provider. With this, no messages are duplicated --- repo2docker/contentproviders/doi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repo2docker/contentproviders/doi.py b/repo2docker/contentproviders/doi.py index 065602b7..64b93202 100644 --- a/repo2docker/contentproviders/doi.py +++ b/repo2docker/contentproviders/doi.py @@ -58,7 +58,7 @@ def doi2url(self, doi): # Reraise any other errors because if the DOI service is down (or # we hit a rate limit) we don't want to silently continue to the # default Git provider as this leads to a misleading error. - logging.error(f"DOI {doi} does not resolve: {e}") + self.log.error(f"DOI {doi} does not resolve: {e}") raise return resp.url else: @@ -70,7 +70,7 @@ def fetch_file(self, file_ref, host, output_dir, unzip=False): # file related to a record file_url = deep_get(file_ref, host["download"]) fname = deep_get(file_ref, host["filename"]) - logging.debug(f"Downloading file {file_url} as {fname}\n") + self.log.debug(f"Downloading file {file_url} as {fname}\n") yield f"Requesting {file_url}\n" resp = self._request(file_url, stream=True)