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)
| 75 | |
| 76 | |
| 77 | def 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 | |
| 102 | def print_node_warnings(tmp_dir, colors): |
no test coverage detected