mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Add another fallback to log emitting in case of unicode-related error.
This commit is contained in:
parent
93feb71b66
commit
b64926814b
@ -133,7 +133,10 @@ class BetterFileHandler(logging.FileHandler):
|
||||
try:
|
||||
self.stream.write(msg.encode("utf8"))
|
||||
except (UnicodeError, TypeError):
|
||||
self.stream.write(msg.encode("utf8").decode('ascii', 'replace'))
|
||||
try:
|
||||
self.stream.write(msg.encode("utf8").decode('ascii', 'replace'))
|
||||
except (UnicodeError, TypeError):
|
||||
self.stream.write(repr(msg))
|
||||
self.stream.write(os.linesep)
|
||||
try:
|
||||
self.flush()
|
||||
|
Loading…
Reference in New Issue
Block a user