Skip to content

Commit

Permalink
Incorrectly setup logger
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Dec 28, 2023
1 parent 736ea43 commit 0d2325a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions drms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions drms/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion drms/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __repr__(self):
return f"<HttpJsonClient: {self._server.name}>"

def _json_request(self, url):
logger.info(url)
logger.debug(f"URL for request: {url}")
return HttpJsonRequest(url, self._server.encoding)

@property
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d2325a

Please sign in to comment.