John Vandenberg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/146045

Change subject: Log requests served from the API cache
......................................................................

Log requests served from the API cache

There is no logging of requests successfully served from the API cache.
Typically threadedhttp logs the request, and api logs the response.

This change logs both request and response when CachedRequest
does not need to submit the request.

Change-Id: Ib4aea6b5d401121fedb2ae91b8869b1872d1b4db
---
M pywikibot/data/api.py
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/45/146045/1

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index bb5c1cb..fc8f14d 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -489,6 +489,8 @@
             if self._expired(self._cachetime):
                 self._data = None
                 return False
+            pywikibot.debug(u"Cached API request:\n" + uniquedescr, _logger)
+            pywikibot.debug(u"Cached API response:\n" + repr(self._data), 
_logger)
             return True
         except IOError as e:
             # file not found

-- 
To view, visit https://gerrit.wikimedia.org/r/146045
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4aea6b5d401121fedb2ae91b8869b1872d1b4db
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to