summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-12-08 10:56:46 +0200
committerLars Wirzenius <liw@liw.fi>2017-12-08 10:56:46 +0200
commitc63ff41c6047d69981af7de7b8adf4dffd29158c (patch)
tree2ddb4ce0d08317483097df667687f74909a2a0bb
parentb348773252afa44945197b200db82e0b9da67bbb (diff)
downloadapifw-c63ff41c6047d69981af7de7b8adf4dffd29158c.tar.gz
Add: log message for when callback has happened
This is for making it easier to see where time is spent.
-rw-r--r--NEWS1
-rw-r--r--apifw/http.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index d2a2593..2ac7407 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ This file summarizes changes between releases of `apifw`.
Version 0.30+git, not yet released
----------------------------------
+* Log when callbacks have happened.
Version 0.30, released 2017-12-07
----------------------------------
diff --git a/apifw/http.py b/apifw/http.py
index 0675442..7b5a8e9 100644
--- a/apifw/http.py
+++ b/apifw/http.py
@@ -80,6 +80,12 @@ class HttpTransaction:
}
self._logger(self._combine_dicts(log, self.construct_response_log()))
+ def _log_callback(self):
+ log = {
+ 'msg_type': 'http-callback',
+ }
+ self._logger(log)
+
def _log_error(self, exc):
log = {
'msg_type': 'error',
@@ -99,6 +105,7 @@ class HttpTransaction:
self._counter()
self._log_request()
data = callback(*args, **kwargs)
+ self._log_callback()
self.amend_response()
self._log_response()
return data