mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
pyln: Replace undecodeable symbols when tailing logs
Logs may contain non-ASCII and non-UTF8 symbols, which crashes the tailer. It's better to replace them with a glyph representing undecodeable symbols instead, and handle the issue further up the call-chain.
This commit is contained in:
committed by
neil saitug
parent
bb0910999e
commit
76124eb800
@@ -208,7 +208,7 @@ class TailableProc(object):
|
|||||||
if len(line) == 0:
|
if len(line) == 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
line = line.decode('ASCII').rstrip()
|
line = line.decode('UTF-8', 'replace').rstrip()
|
||||||
|
|
||||||
if self.log_filter(line):
|
if self.log_filter(line):
|
||||||
continue
|
continue
|
||||||
@@ -227,7 +227,7 @@ class TailableProc(object):
|
|||||||
for line in iter(self.proc.stderr.readline, ''):
|
for line in iter(self.proc.stderr.readline, ''):
|
||||||
if len(line) == 0:
|
if len(line) == 0:
|
||||||
break
|
break
|
||||||
self.err_logs.append(line.rstrip().decode('ASCII'))
|
self.err_logs.append(line.rstrip().decode('UTF-8', 'replace')).rstrip()
|
||||||
self.proc.stderr.close()
|
self.proc.stderr.close()
|
||||||
|
|
||||||
def is_in_log(self, regex, start=0):
|
def is_in_log(self, regex, start=0):
|
||||||
|
|||||||
Reference in New Issue
Block a user