fix a traceback when we accidentally seek() in the middle of a char
This commit is contained in:
parent
423bae05b0
commit
344e8c8d6c
1 changed files with 8 additions and 4 deletions
|
@ -81,15 +81,19 @@ class Logger(object):
|
|||
return
|
||||
|
||||
pos = fd.seek(0, 2)
|
||||
while len(fd.readlines()) < nb + 1:
|
||||
reads = fd.readlines()
|
||||
while len(reads) < nb + 1:
|
||||
pos -= 100
|
||||
if pos < 0:
|
||||
break
|
||||
fd.seek(pos)
|
||||
fd.seek(pos)
|
||||
logs = fd.readlines()
|
||||
try:
|
||||
reads = fd.readlines()
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
fd.close()
|
||||
return logs[-nb:]
|
||||
logs = reads[-nb:]
|
||||
return logs
|
||||
|
||||
def log_message(self, jid, nick, msg):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue