Logging: log method names at INFO level, also log API return data at DEBUG level
This commit is contained in:
parent
5c9509dfc4
commit
dd8836e59b
|
@ -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.
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue