More log tweaks
This commit is contained in:
parent
e4bad8007f
commit
a4d34358fe
1 changed files with 7 additions and 6 deletions
|
|
@ -390,17 +390,18 @@ class EvenniaLogFile(logfile.LogFile):
|
||||||
**kwargs: same kwargs as file.readlines
|
**kwargs: same kwargs as file.readlines
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Generator: lines from our _file attribute.
|
lines (list): lines from our _file attribute.
|
||||||
"""
|
"""
|
||||||
|
lines = []
|
||||||
for line in self._file.readlines(*args, **kwargs):
|
for line in self._file.readlines(*args, **kwargs):
|
||||||
try:
|
try:
|
||||||
lin = line.decode("utf-8")
|
lines.append(line.decode("utf-8"))
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
try:
|
try:
|
||||||
lin = str(lin)
|
lines.append(str(line))
|
||||||
except Exception:
|
except Exception:
|
||||||
lin = ""
|
lines.append("")
|
||||||
yield lin
|
return lines
|
||||||
|
|
||||||
|
|
||||||
_LOG_FILE_HANDLES = {} # holds open log handles
|
_LOG_FILE_HANDLES = {} # holds open log handles
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue