diff --git a/frigate/api/app.py b/frigate/api/app.py index d4ba2a0e9..11ee37665 100644 --- a/frigate/api/app.py +++ b/frigate/api/app.py @@ -418,12 +418,15 @@ def process_logs( if date_end == 0: date_end = clean_line.index(" ") + # for frigate logs attempt to consolidate by comparing + # the first 3 characters of the millisecond portion key_length = date_end - (6 if service == "frigate" else 0) new_key = clean_line[:key_length] if new_key == current_key: - current_line += f"\n{clean_line[date_end:].strip()}" + # use zero-width space character to delineate that this is a continuation + current_line += f"\u200b{clean_line[date_end:].strip()}" continue else: if current_line: diff --git a/web/src/pages/Logs.tsx b/web/src/pages/Logs.tsx index 1514bbf8f..d7f14d944 100644 --- a/web/src/pages/Logs.tsx +++ b/web/src/pages/Logs.tsx @@ -506,7 +506,7 @@ function LogLineData({ return (
-
+
{line.content}
diff --git a/web/src/utils/logUtil.ts b/web/src/utils/logUtil.ts index f3e1d3806..77387f1b4 100644 --- a/web/src/utils/logUtil.ts +++ b/web/src/utils/logUtil.ts @@ -24,7 +24,10 @@ export function parseLogLines(logService: LogType, logs: string[]) { dateStamp: line.substring(0, 19), severity: "info", section: "startup", - content: line.substring(infoIndex + 6).trim(), + content: line + .substring(infoIndex + 6) + .trim() + .replace(/\u200b/g, "\n"), }; } @@ -32,7 +35,10 @@ export function parseLogLines(logService: LogType, logs: string[]) { dateStamp: line.substring(0, 19), severity: "unknown", section: "unknown", - content: line.substring(30).trim(), + content: line + .substring(30) + .trim() + .replace(/\u200b/g, "\n"), }; } @@ -44,7 +50,7 @@ export function parseLogLines(logService: LogType, logs: string[]) { return null; } - return { + const logLine = { dateStamp: match.toString().slice(1, -1), severity: pythonSeverity .exec(line) @@ -54,8 +60,11 @@ export function parseLogLines(logService: LogType, logs: string[]) { section: sectionMatch.toString(), content: line .substring(line.indexOf(":", match.index + match[0].length) + 2) - .trim(), + .trim() + .replace(/\u200b/g, "\n"), }; + + return logLine; }) .filter((value) => value != null) as LogLine[]; } else if (logService == "go2rtc") {