From a41cca5751d429ca6cf635d0e74e0476ea0de233 Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Thu, 10 Dec 2015 09:44:02 -0500 Subject: [PATCH] tornado_log_function: Make work with Tornado 4.3. Looks like HTTPHeaders changed a little: TypeError: is not JSON serializable --- docs/history.rst | 6 ++++++ sprockets/logging/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/history.rst b/docs/history.rst index b1e7913..aaba089 100644 --- a/docs/history.rst +++ b/docs/history.rst @@ -1,6 +1,10 @@ Version History =============== +`Next Release`_ +--------------- +- Updated ``tornado_log_function`` to work with Tornado 4.3. + `1.3.2`_ Oct 2, 2015 --------------------- - Switch to packaging as a package instead of a py_module. @@ -40,6 +44,8 @@ Version History --------------------- - Added :class:`sprockets.logging.ContextFilter` +.. _Next Release: https://github.com/sprockets/sprockets.logging/compare/1.3.2...master + .. _1.3.2: https://github.com/sprockets/sprockets.logging/compare/1.3.1...1.3.2 .. _1.3.1: https://github.com/sprockets/sprockets.logging/compare/1.3.0...1.3.1 .. _1.3.0: https://github.com/sprockets/sprockets.logging/compare/1.2.1...1.3.0 diff --git a/sprockets/logging/__init__.py b/sprockets/logging/__init__.py index 78d31ce..4a08ba2 100644 --- a/sprockets/logging/__init__.py +++ b/sprockets/logging/__init__.py @@ -145,7 +145,7 @@ def tornado_log_function(handler): handler.request.headers.get('Correlation-ID', None)) log_method('', {'correlation_id': correlation_id, 'duration': 1000.0 * handler.request.request_time(), - 'headers': handler.request.headers, + 'headers': dict(handler.request.headers), 'method': handler.request.method, 'path': handler.request.path, 'protocol': handler.request.protocol,