Parses a single line of a system log into a structured SystemLogLine object.
SystemLogLine
The function expects the log line to follow the format:
YYYY-MM-DD HH:MM:SS.sss (uptime) [id]file:linelevel|message
where the id part is optional.
id
A SystemLogLine object with parsed fields, or undefined if the line cannot be parsed.
undefined
const line = '2025-12-05 10:01:23.123 (12:34:56) [device1]main.ts:123INFO|Started';const parsed = parseSystemLogLine(line);console.log(parsed?.date); // → Date object for '2025-12-05 10:01:23.123'console.log(parsed?.uptime); // → '12:34:56'console.log(parsed?.id); // → 'device1'console.log(parsed?.message); // → 'Started'
s
A single system log line as a string.
Generated using TypeDoc
Parses a single line of a system log into a structured
SystemLogLineobject.The function expects the log line to follow the format:
where the
idpart is optional.Returns
A
SystemLogLineobject with parsed fields, orundefinedif the line cannot be parsed.Example
Remarks
s(dotAll) flag; this may not be supported in all browsers.undefined.