Parse a single line of a log into a structured LogLine object.
Elements in a line are expected to be separated by the `-` character.
The first element is the date time, the second the log level, the third
is the logger name and the last is the message.
Note that the third element is optional and that the message may
contain additional `-` characters. This can be handled using the
`start_idx_message` parameter.
Parameters
----------
logline: str
line of a log
start_idx_message: int, optional
index at which split of the ling the message starts
Returns
-------
LogLine
"""
_split=logline.strip().split("-")
assertlen(_split)>=start_idx_message,f"A logged line should consists of a least {start_idx_message} elements with the format [TIME - LOGLEVEL - ... - MESSAGE] but got [{logline.strip()}]"
assert (
len(_split)>=start_idx_message
),f"A logged line should consists of a least {start_idx_message} elements with the format [TIME - LOGLEVEL - ... - MESSAGE] but got [{logline.strip()}]"