Fix text in multiline case

main
Micke Nordin 3 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
if cur_has_timestamp and next_has_timestamp:
text = ":". join(line.split(':')[1:])
timestamp = line.split(']')[0].split('[')[1]
text = line.split(']')[1].lstrip(':').strip()
out.append({'timestamp': timestamp, 'text': text})
text = ""
timestamp = ""
# Start of multiline
elif cur_has_timestamp:
timestamp = line.split(']')[0].split('[')[1]
text = ":". join(line.split(':')[1:])
text = line.split(']')[1].lstrip(':').strip()
# End of multiline
elif next_has_timestamp:
text += f'\n{line}'
text += f'\n{line.strip()}'
out.append({'timestamp': timestamp, 'text': text})
text = ""
timestamp = ""
# Middle of multiline
else:
text += f'\n{line}'
text += f'\n{line.strip()}'
else:
out = string

Loading…
Cancel
Save