Fix text in multiline case

main
Micke Nordin 2 months ago
parent c26a46e9a4
commit fb89d01be1

@ -99,21 +99,24 @@ def run_audit(url: str, jsonout: bool, headers: dict):
) )
# Simple case, just one line with timestamp # Simple case, just one line with timestamp
if cur_has_timestamp and next_has_timestamp: if cur_has_timestamp and next_has_timestamp:
text = ":". join(line.split(':')[1:])
timestamp = line.split(']')[0].split('[')[1] timestamp = line.split(']')[0].split('[')[1]
text = line.split(']')[1].lstrip(':').strip()
out.append({'timestamp': timestamp, 'text': text}) out.append({'timestamp': timestamp, 'text': text})
text = "" text = ""
timestamp = "" timestamp = ""
# Start of multiline
elif cur_has_timestamp: elif cur_has_timestamp:
timestamp = line.split(']')[0].split('[')[1] timestamp = line.split(']')[0].split('[')[1]
text = ":". join(line.split(':')[1:]) text = line.split(']')[1].lstrip(':').strip()
# End of multiline
elif next_has_timestamp: elif next_has_timestamp:
text += f'\n{line}' text += f'\n{line.strip()}'
out.append({'timestamp': timestamp, 'text': text}) out.append({'timestamp': timestamp, 'text': text})
text = "" text = ""
timestamp = "" timestamp = ""
# Middle of multiline
else: else:
text += f'\n{line}' text += f'\n{line.strip()}'
else: else:
out = string out = string

Loading…
Cancel
Save