diff --git a/web/src/pages/Logs.tsx b/web/src/pages/Logs.tsx index 948fa8884..c516b130f 100644 --- a/web/src/pages/Logs.tsx +++ b/web/src/pages/Logs.tsx @@ -15,7 +15,7 @@ const frigateDateStamp = /\[[\d\s-:]*]/; const frigateSeverity = /(DEBUG)|(INFO)|(WARNING)|(ERROR)/; const frigateSection = /[\w.]*/; -const goSeverity = /(DEB )|(INF )|(WARN )|(ERR )/; +const goSeverity = /(DEB )|(INF )|(WRN )|(ERR )/; const goSection = /\[[\w]*]/; const ngSeverity = /(GET)|(POST)|(PUT)|(PATCH)|(DELETE)/; @@ -152,9 +152,28 @@ function Logs() { contentStart = line.indexOf(section) + section.length + 2; } + let severityCat: LogSeverity; + switch (severity?.at(0)?.toString().trim()) { + case "INF": + severityCat = "info"; + break; + case "WRN": + severityCat = "warning"; + break; + case "ERR": + severityCat = "error"; + break; + case "DBG": + case "TRC": + severityCat = "debug"; + break; + default: + severityCat = "info"; + } + return { dateStamp: line.substring(0, 19), - severity: "INFO", + severity: severityCat, section: section, content: line.substring(contentStart).trim(), }; @@ -169,7 +188,7 @@ function Logs() { return { dateStamp: line.substring(0, 19), - severity: "INFO", + severity: "info", section: ngSeverity.exec(line)?.at(0)?.toString() ?? "META", content: line.substring(line.indexOf(" ", 20)).trim(), }; @@ -299,7 +318,7 @@ function Logs() { value={item} aria-label={`Select ${item}`} > -