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
|
**kwargs: same kwargs as file.readlines
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
lines (list): lines from our _file attribute.
|
Generator: lines from our _file attribute.
|
||||||
"""
|
"""
|
||||||
lines = []
|
|
||||||
for line in self._file.readlines(*args, **kwargs):
|
for line in self._file.readlines(*args, **kwargs):
|
||||||
try:
|
try:
|
||||||
lines.append(line.decode("utf-8"))
|
lin = line.decode("utf-8")
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
try:
|
try:
|
||||||
lines.append(str(line))
|
lin = str(lin)
|
||||||
except Exception:
|
except Exception:
|
||||||
lines.append("")
|
lin = ""
|
||||||
return lines
|
yield lin
|
||||||
|
|
||||||
|
|
||||||
_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