summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-08-04 17:30:52 +0300
committerLars Wirzenius <liw@liw.fi>2017-08-04 17:30:52 +0300
commitda82fc487b2a6d7975ea845e07bdf6b593dc1db4 (patch)
tree056bb18a23e0c05f11e39585923c873651831f43
parentba79dc2713724fe3c384a4cbf2c0580c4f19422b (diff)
downloadapifw-da82fc487b2a6d7975ea845e07bdf6b593dc1db4.tar.gz
Revert "Add: way to set log context in API"
This reverts commit 4b438adf30380d8cee7c17319e46ffebb4b0385f. This turned out to be a bad idea.
-rw-r--r--NEWS1
-rw-r--r--apifw/bottleapp.py13
-rw-r--r--apifw/http.py6
3 files changed, 0 insertions, 20 deletions
diff --git a/NEWS b/NEWS
index 4bda6c9..f36bf17 100644
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,6 @@ Version 0.6+git, not yet released
Version 0.6, released 2017-08-04
---------------------------------
-* Add a way to set the log (slog) context via the API class.
Version 0.5, released 2017-08-03
---------------------------------
diff --git a/apifw/bottleapp.py b/apifw/bottleapp.py
index 1b6f6b9..b248858 100644
--- a/apifw/bottleapp.py
+++ b/apifw/bottleapp.py
@@ -36,18 +36,6 @@ class BottleLoggingPlugin(apifw.HttpTransaction):
# the HTTP request and response, and to amend the response by
# adding a Date header.
- def __init__(self):
- super().__init__()
- self._context_setter = None
-
- def set_log_context_setter(self, context_setter):
- self._context_setter = context_setter
-
- def set_log_context(self):
- if self._context_setter is not None:
- return self._context_setter()
- return None
-
def apply(self, callback, route):
def wrapper(*args, **kwargs):
@@ -228,7 +216,6 @@ def create_bottle_application(api, logger, config):
app = BottleApplication(bottleapp, api)
plugin = BottleLoggingPlugin()
- plugin.set_log_context_setter(api.get_log_context)
if logger:
plugin.set_dict_logger(logger)
app.add_plugin(plugin)
diff --git a/apifw/http.py b/apifw/http.py
index 2b2855f..6b6a1e2 100644
--- a/apifw/http.py
+++ b/apifw/http.py
@@ -86,18 +86,12 @@ class HttpTransaction:
log.update(d)
return log
- def set_log_context(self, contex):
- # This can be overridden by subclasses.
- pass
-
def perform_transaction(self, callback, *args, **kwargs):
try:
- old_context = self.set_log_context()
self._log_request()
data = callback(*args, **kwargs)
self.amend_response()
self._log_response()
- self.set_logcontext(old_context)
return data
except SystemExit:
# If we're exiting, we exit. No need to log an error.