aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-15 20:16:32 -0400
committerRapptz <[email protected]>2016-06-15 20:16:32 -0400
commitfa0c98da4ca0fa3411949c435fa9bdba4244a8e0 (patch)
tree88b66d799d6e66e90b61e5c20fdad02f85b21538
parentAdd Client.get_message (diff)
downloaddiscord.py-fa0c98da4ca0fa3411949c435fa9bdba4244a8e0.tar.xz
discord.py-fa0c98da4ca0fa3411949c435fa9bdba4244a8e0.zip
Make logging for HTTP requests more useful.
-rw-r--r--discord/http.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/discord/http.py b/discord/http.py
index 584b2f07..da301f8b 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -64,8 +64,8 @@ class HTTPClient:
CHANNELS = API_BASE + '/channels'
APPLICATIONS = API_BASE + '/oauth2/applications'
- SUCCESS_LOG = '{method} {url} with {json} has received {text}'
- REQUEST_LOG = '{method} {url} has returned {status}'
+ SUCCESS_LOG = '{method} {url} has received {text}'
+ REQUEST_LOG = '{method} {url} with {json} has returned {status}'
def __init__(self, connector=None, *, loop=None):
self.loop = asyncio.get_event_loop() if loop is None else loop
@@ -103,15 +103,14 @@ class HTTPClient:
with (yield from lock):
for tries in range(5):
r = yield from self.session.request(method, url, **kwargs)
- log.debug(self.REQUEST_LOG.format(method=method, url=url, status=r.status))
+ log.debug(self.REQUEST_LOG.format(method=method, url=url, status=r.status, json=kwargs.get('data')))
try:
# even errors have text involved in them so this is safe to call
data = yield from json_or_text(r)
# the request was successful so just return the text/json
if 300 > r.status >= 200:
- log.debug(self.SUCCESS_LOG.format(method=method, url=url,
- json=kwargs.get('data'), text=data))
+ log.debug(self.SUCCESS_LOG.format(method=method, url=url, text=data))
return data
# we are being rate limited