From 0d2325a6a3b9d6b1ae3a83ac6fa5958c8983253c Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 27 Dec 2023 23:22:46 -0800 Subject: [PATCH] Incorrectly setup logger --- drms/__init__.py | 1 + drms/client.py | 6 +++--- drms/json.py | 2 +- setup.cfg | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drms/__init__.py b/drms/__init__.py index c911283..c191273 100644 --- a/drms/__init__.py +++ b/drms/__init__.py @@ -13,6 +13,7 @@ from pathlib import Path logger = logging.getLogger(__name__) +logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s: %(message)s") from .client import Client, ExportRequest, SeriesInfo # NOQA: E402 from .config import ServerConfig, register_server # NOQA: E402 diff --git a/drms/client.py b/drms/client.py index 7f14ac3..e8ede56 100644 --- a/drms/client.py +++ b/drms/client.py @@ -568,16 +568,16 @@ def download(self, directory, *, index=None, fname_from_rec=None): fpath_tmp = self._next_available_filename(f"{fpath_new}.part") logger.info(f"Downloading file {int(i + 1)} of {int(ndata)}...") logger.info(f" record: {di.record}") - logger.info(f" filename: {di.filename}") + logger.info(f" filename: {di.filename}") try: urlretrieve(di.url, fpath_tmp) except (HTTPError, URLError): fpath_new = None - logger.info(" -> Error: Could not download file") + logger.info(" -> Error: Could not download file") else: fpath_new = self._next_available_filename(fpath) Path(fpath_tmp).rename(fpath_new) - logger.info(f" -> {os.path.relpath(fpath_new)}") + logger.info(f" -> {os.path.relpath(fpath_new)}") downloads.append(fpath_new) res = data[["record", "url"]].copy() diff --git a/drms/json.py b/drms/json.py index c5ceb96..4f5ae6b 100644 --- a/drms/json.py +++ b/drms/json.py @@ -87,7 +87,7 @@ def __repr__(self): return f"" def _json_request(self, url): - logger.info(url) + logger.debug(f"URL for request: {url}") return HttpJsonRequest(url, self._server.encoding) @property diff --git a/setup.cfg b/setup.cfg index 7205515..8fe1953 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,6 +67,7 @@ console_scripts = [tool:pytest] testpaths = "drms" "docs" norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" "examples" ".history" "paper" "drms[\/]_dev" +log_cli = True doctest_plus = enabled doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS addopts = --doctest-rst -p no:unraisableexception -p no:threadexception