mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pytest: Filter out some unimportant log lines
Mostly `lightningd` complaining about not being able to estimate fees. Safes us a lot of log space when some tests time out, and safes us a few context switches between log appender and log watchers. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
1a9c7783b7
commit
2e8b3066e4
@@ -63,6 +63,10 @@ class TailableProc(object):
|
|||||||
# Should we be logging lines we read from stdout?
|
# Should we be logging lines we read from stdout?
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
|
|
||||||
|
# A filter function that'll tell us whether to filter out the line (not
|
||||||
|
# pass it to the log matcher and not print it to stdout).
|
||||||
|
self.log_filter = lambda line: False
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Start the underlying process and start monitoring it.
|
"""Start the underlying process and start monitoring it.
|
||||||
"""
|
"""
|
||||||
@@ -114,6 +118,8 @@ class TailableProc(object):
|
|||||||
for line in iter(self.proc.stdout.readline, ''):
|
for line in iter(self.proc.stdout.readline, ''):
|
||||||
if len(line) == 0:
|
if len(line) == 0:
|
||||||
break
|
break
|
||||||
|
if self.log_filter(line.decode('ASCII')):
|
||||||
|
continue
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
logging.debug("%s: %s", self.prefix, line.decode().rstrip())
|
logging.debug("%s: %s", self.prefix, line.decode().rstrip())
|
||||||
with self.logs_cond:
|
with self.logs_cond:
|
||||||
@@ -286,6 +292,16 @@ class LightningD(TailableProc):
|
|||||||
self.opts['dev-allow-localhost'] = None
|
self.opts['dev-allow-localhost'] = None
|
||||||
self.prefix = 'lightningd-%d' % (node_id)
|
self.prefix = 'lightningd-%d' % (node_id)
|
||||||
|
|
||||||
|
filters = [
|
||||||
|
"Unable to estimate",
|
||||||
|
"No fee estimate",
|
||||||
|
"Connected json input",
|
||||||
|
"Forcing fee rate, ignoring estimate",
|
||||||
|
]
|
||||||
|
|
||||||
|
filter_re = re.compile(r'({})'.format("|".join(filters)))
|
||||||
|
self.log_filter = lambda line: filter_re.search(line) is not None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cmd_line(self):
|
def cmd_line(self):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user