diff --git a/hoover/handlers.py b/hoover/handlers.py index 20b8b47..aa6fae7 100644 --- a/hoover/handlers.py +++ b/hoover/handlers.py @@ -1,6 +1,9 @@ '''A couple of logging handlers which should play nicely with the Python logging library.''' import sys, logging, socket + +import copy + try: from simplejson import dumps except ImportError: @@ -37,6 +40,8 @@ def __init__(self, session=None, token='', inputname='', input=None, def emit(self, record): if isinstance(record.msg, (list, dict)): + # prevent sideffect for other handlers processing the same record. + record = copy.copy(record) record.msg = dumps(record.msg, cls=self.json_class, default=str) msg = self.format(record) async_post_to_endpoint(self.endpoint, msg)