Changeset View
Changeset View
Standalone View
Standalone View
test/functional/combine_logs.py
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | try: | ||||
event = line | event = line | ||||
timestamp = time_match.group() | timestamp = time_match.group() | ||||
# if it doesn't have a timestamp, it's a continuation line of the previous log. | # if it doesn't have a timestamp, it's a continuation line of the previous log. | ||||
else: | else: | ||||
event += "\n" + line | event += "\n" + line | ||||
# Flush the final event | # Flush the final event | ||||
yield LogEvent(timestamp=timestamp, source=source, event=event.rstrip()) | yield LogEvent(timestamp=timestamp, source=source, event=event.rstrip()) | ||||
except FileNotFoundError: | except FileNotFoundError: | ||||
print("File {} could not be opened. Continuing without it.".format(logfile), file=sys.stderr) | print("File {} could not be opened. Continuing without it.".format( | ||||
logfile), file=sys.stderr) | |||||
def print_logs(log_events, color=False, html=False): | def print_logs(log_events, color=False, html=False): | ||||
"""Renders the iterator of log events into text or html.""" | """Renders the iterator of log events into text or html.""" | ||||
if not html: | if not html: | ||||
colors = defaultdict(lambda: '') | colors = defaultdict(lambda: '') | ||||
if color: | if color: | ||||
colors["test"] = "\033[0;36m" # CYAN | colors["test"] = "\033[0;36m" # CYAN | ||||
Show All 23 Lines |