Changeset View
Changeset View
Standalone View
Standalone View
test/functional/combine_logs.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
"""Combine logs from multiple bitcoin nodes as well as the test_framework log. | """Combine logs from multiple bitcoin nodes as well as the test_framework log. | ||||
This streams the combined log output to stdout. Use combine_logs.py > outputfile | This streams the combined log output to stdout. Use combine_logs.py > outputfile | ||||
to write to an outputfile.""" | to write to an outputfile.""" | ||||
import argparse | import argparse | ||||
from collections import defaultdict, namedtuple | from collections import defaultdict, namedtuple | ||||
import heapq | import heapq | ||||
import itertools | import itertools | ||||
import os | import os | ||||
import re | import re | ||||
import sys | import sys | ||||
# Matches on the date format at the start of the log event | # Matches on the date format at the start of the log event | ||||
TIMESTAMP_PATTERN = re.compile(r"^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{6}") | TIMESTAMP_PATTERN = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z") | ||||
LogEvent = namedtuple('LogEvent', ['timestamp', 'source', 'event']) | LogEvent = namedtuple('LogEvent', ['timestamp', 'source', 'event']) | ||||
def main(): | def main(): | ||||
"""Main function. Parses args, reads the log files and renders them as text or html.""" | """Main function. Parses args, reads the log files and renders them as text or html.""" | ||||
parser = argparse.ArgumentParser( | parser = argparse.ArgumentParser( | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |