[qa] combine_logs: Use ordered list for logfiles

This commit is contained in:
MarcoFalke 2017-03-25 15:16:26 +01:00
parent a0b1e57b20
commit fa4535df57

View File

@ -6,8 +6,8 @@ to write to an outputfile."""
import argparse import argparse
from collections import defaultdict, namedtuple from collections import defaultdict, namedtuple
import glob
import heapq import heapq
import itertools
import os import os
import re import re
import sys import sys
@ -49,7 +49,10 @@ def read_logs(tmp_dir):
for each of the input log files.""" for each of the input log files."""
files = [("test", "%s/test_framework.log" % tmp_dir)] files = [("test", "%s/test_framework.log" % tmp_dir)]
for i, logfile in enumerate(glob.glob("%s/node*/regtest/debug.log" % tmp_dir)): for i in itertools.count():
logfile = "{}/node{}/regtest/debug.log".format(tmp_dir, i)
if not os.path.isfile(logfile):
break
files.append(("node%d" % i, logfile)) files.append(("node%d" % i, logfile))
return heapq.merge(*[get_log_events(source, f) for source, f in files]) return heapq.merge(*[get_log_events(source, f) for source, f in files])