diff options
author | Jakub Stasiak <jakub@stasiak.at> | 2018-03-28 13:47:46 +0200 |
---|---|---|
committer | Ashley Camba <ashwoods@gmail.com> | 2018-03-29 21:44:45 +0200 |
commit | 9223d40d0c8da7fbbe60eb2bf58fea3992bee910 (patch) | |
tree | 8a8b526f13ec77863397534f264138bb2d6c64fd /raven | |
parent | e056c9dd6852d77b49ad1041f63605eb2523c286 (diff) | |
download | raven-9223d40d0c8da7fbbe60eb2bf58fea3992bee910.tar.gz |
logging: Stop mutating record.data
Without this patch raven's logging handler can't be used with connexion,
because connexion does the following[1]:
logger.debug('Getting data and status code',
extra={
'data': response,
'data_type': type(response),
'url': flask.request.url
})
When response was a dictionary raven would modify it, thus causing
unexpected and unwanted side effects.
[1] https://github.com/zalando/connexion/blob/9f20c5ffb70ccde05193077e677da2a09af362c9/connexion/apis/flask_api.py#L110
Diffstat (limited to 'raven')
-rw-r--r-- | raven/handlers/logging.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/raven/handlers/logging.py b/raven/handlers/logging.py index eb5b7e3..49a17ce 100644 --- a/raven/handlers/logging.py +++ b/raven/handlers/logging.py @@ -40,6 +40,9 @@ def extract_extra(record, reserved=RESERVED, contextual=CONTEXTUAL): extra = {'data': extra} else: extra = {} + else: + # record.data may be something we don't want to mutate to not cause unexpected side effects + extra = dict(extra) for k, v in iteritems(vars(record)): if k in reserved: |