Logger: if unicode fails, try plain str decoding.

It is just a second attempt to get the message out instead
of raising an exception in the wrong place there.

bzr revid: p_christ@hol.gr-20090129073549-voc3eg28xitx6tzt
This commit is contained in:
P. Christeas 2009-01-29 09:35:49 +02:00
parent 876e0667e6
commit 313744ee35
1 changed files with 4 additions and 1 deletions

View File

@ -163,7 +163,10 @@ class Logger(object):
if isinstance(msg, Exception):
msg = tools.exception_to_unicode(msg)
result = tools.ustr(msg).strip().split('\n')
try:
result = tools.ustr(msg).strip().split('\n')
except UnicodeDecodeError:
result = msg.strip().split('\n')
if len(result)>1:
for idx, s in enumerate(result):
level_method('[%02d]: %s' % (idx+1, s,))