mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Test generator for log file return
This commit is contained in:
parent
5d1ff40d75
commit
e4bad8007f
1 changed files with 5 additions and 6 deletions
|
|
@ -390,18 +390,17 @@ class EvenniaLogFile(logfile.LogFile):
|
|||
**kwargs: same kwargs as file.readlines
|
||||
|
||||
Returns:
|
||||
lines (list): lines from our _file attribute.
|
||||
Generator: lines from our _file attribute.
|
||||
"""
|
||||
lines = []
|
||||
for line in self._file.readlines(*args, **kwargs):
|
||||
try:
|
||||
lines.append(line.decode("utf-8"))
|
||||
lin = line.decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
lines.append(str(line))
|
||||
lin = str(lin)
|
||||
except Exception:
|
||||
lines.append("")
|
||||
return lines
|
||||
lin = ""
|
||||
yield lin
|
||||
|
||||
|
||||
_LOG_FILE_HANDLES = {} # holds open log handles
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue