mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Catch unicode-decode error in logger display
This commit is contained in:
parent
36ded8408d
commit
c041425bca
1 changed files with 9 additions and 1 deletions
|
|
@ -392,7 +392,15 @@ class EvenniaLogFile(logfile.LogFile):
|
|||
Returns:
|
||||
lines (list): lines from our _file attribute.
|
||||
"""
|
||||
return [line.decode("utf-8") for line in self._file.readlines(*args, **kwargs)]
|
||||
lines = []
|
||||
for line in self._file.readlines(*args, **kwargs):
|
||||
try:
|
||||
lines.append(line.decode("utf-8"))
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
lines.append(str(line))
|
||||
except Exception:
|
||||
lines.append("")
|
||||
|
||||
|
||||
_LOG_FILE_HANDLES = {} # holds open log handles
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue