MCPcopy Create free account
hub / github.com/ElementsProject/elements / read_logs

Function read_logs

test/functional/combine_logs.py:77–99  ·  view source on GitHub ↗

Reads log files. Delegates to generator function get_log_events() to provide individual log events for each of the input log files.

(tmp_dir, chain)

Source from the content-addressed store, hash-verified

75
76
77def read_logs(tmp_dir, chain):
78 """Reads log files.
79
80 Delegates to generator function get_log_events() to provide individual log events
81 for each of the input log files."""
82
83 # Find out what the folder is called that holds the debug.log file
84 glob = pathlib.Path(tmp_dir).glob('node0/**/debug.log')
85 path = next(glob, None)
86 if path:
87 assert next(glob, None) is None # more than one debug.log, should never happen
88 chain = re.search(r'node0/(.+?)/debug\.log$', path.as_posix()).group(1) # extract the chain name
89 else:
90 chain = 'regtest' # fallback to regtest (should only happen when none exists)
91
92 files = [("test", "%s/test_framework.log" % tmp_dir)]
93 for i in itertools.count():
94 logfile = "{}/node{}/{}/debug.log".format(tmp_dir, i, chain)
95 if not os.path.isfile(logfile):
96 break
97 files.append(("node%d" % i, logfile))
98
99 return heapq.merge(*[get_log_events(source, f) for source, f in files])
100
101
102def print_node_warnings(tmp_dir, colors):

Callers 1

mainFunction · 0.70

Calls 4

countMethod · 0.80
formatMethod · 0.80
mergeMethod · 0.80
get_log_eventsFunction · 0.70

Tested by

no test coverage detected