Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix side effect of record modified affecting the next in line handler. #12

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -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)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.