Commit 54c7061f authored by Jérome Perrin's avatar Jérome Perrin

cli/coloredlogs: apply a fix for logging objects as msg

As reported on https://github.com/xolox/python-coloredlogs/issues/107
logging objects with a __str__ method returning non-ascii characters
raises UnicodeDecodeError.

We have vendored coloredlogs version 0.5 long time ago, so just
apply the suggested fix here for now.
parent 80997f7e
Pipeline #18202 failed with stage
in 0 seconds
......@@ -176,7 +176,10 @@ class ColoredStreamHandler(logging.StreamHandler):
message = record.msg
try:
if not isinstance(message, basestring):
try:
message = unicode(message)
except UnicodeDecodeError:
message = unicode(str(message), 'utf-8', 'replace')
except NameError:
if not isinstance(message, str):
message = str(message)
......
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