toolong
toolong copied to clipboard
a number in a multiline log message is mistaken for a timestamp
Problem
A number in a log message can be mistaken for a timestamp, which will mess up log merging behavior.
How to reproduce
Load the following log snippet into tl
:
Feb 08 09:50:05 Foo-MacBook-Air loginwindow[588]: IASGetCurrentInstallPhaseList: phases = (
{
ConclusionDelay = 0;
InstallPhase = "IOKit Boot";
InstallPhaseActualPercentageKey = "21.77734375";
InstallPhasePercentageKey = 22;
},
{
ConclusionDelay = 0;
InstallPhase = "Boot-Time Installation";
InstallPhaseActualPercentageKey = "69.01998901367188";
InstallPhasePercentageKey = 69;
}
)
Select the line with "69.01998901367188"
and note that the time in the bottom right is something like "04/07/8304 22:58:38". This causes problems when merging log files because these lines show up at the bottom of the merged logs.
Details
Since the TimestampScanner
is looking for timestamps anywhere in a log line, a format like the following one is going to mistakenly pick up logged data and treat it as a timestamp:
https://github.com/Textualize/toolong/blob/9fe54a6bcd6bcc2b1066c762057b0de812dcd155/src/toolong/timestamps.py#L92-L93