Commit d58b5ad7 authored by David Wilson's avatar David Wilson

core: prevent creation of unicode Message.data

Was triggering a crash indirectly due to Ansible passing us Unicode
strings. Needs a better fix.
parent 31065ffe
......@@ -620,6 +620,9 @@ class LogHandler(logging.Handler):
try:
msg = self.format(rec)
encoded = '%s\x00%s\x00%s' % (rec.name, rec.levelno, msg)
if isinstance(encoded, unicode):
# Logging package emits both :(
encoded = encoded.encode('utf-8')
self.context.send(Message(data=encoded, handle=FORWARD_LOG))
finally:
self.local.in_emit = False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment