Merge pull request #394 from pylast/update-logging

This commit is contained in:
Hugo van Kemenade 2022-04-03 10:57:22 +03:00 committed by GitHub
commit 83aeaddc43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -144,7 +144,8 @@ To enable from your own code:
import logging import logging
import pylast import pylast
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.INFO)
network = pylast.LastFMNetwork(...) network = pylast.LastFMNetwork(...)
``` ```
@ -152,5 +153,8 @@ network = pylast.LastFMNetwork(...)
To enable from pytest: To enable from pytest:
```sh ```sh
pytest --log-cli-level debug -k test_album_search_images pytest --log-cli-level info -k test_album_search_images
``` ```
To also see data returned from the API, use `level=logging.DEBUG` or
`--log-cli-level debug` instead.

View file

@ -822,7 +822,7 @@ class _Request:
"""Representing an abstract web service operation.""" """Representing an abstract web service operation."""
def __init__(self, network, method_name, params=None): def __init__(self, network, method_name, params=None):
logger.debug(method_name) logger.info(method_name)
if params is None: if params is None:
params = {} params = {}
@ -962,7 +962,7 @@ class _Request:
raise MalformedResponseError(self.network, e) from e raise MalformedResponseError(self.network, e) from e
e = doc.getElementsByTagName("lfm")[0] e = doc.getElementsByTagName("lfm")[0]
# logger.debug(doc.toprettyxml()) logger.debug(doc.toprettyxml())
if e.getAttribute("status") != "ok": if e.getAttribute("status") != "ok":
e = doc.getElementsByTagName("error")[0] e = doc.getElementsByTagName("error")[0]