Only continue log level if line starts with whitespace; reintroduce exception detection

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2025-12-05 12:35:21 +00:00
parent 92738feeba
commit c018b60816
5 changed files with 13 additions and 16 deletions
+9 -3
View File
@@ -320,7 +320,7 @@ std::optional<LogParser::ParsedItem> LogParser::parseLog4J()
throw std::runtime_error("unreachable: already verified this was a complete log4j:Event");
}
MessageLevel::Enum LogParser::guessLevel(const QString& line)
MessageLevel::Enum LogParser::guessLevel(const QString& line, MessageLevel::Enum previous)
{
static const QRegularExpression LINE_WITH_LEVEL("^\\[(?<timestamp>[0-9:]+)\\] \\[[^/]+/(?<level>[^\\]]+)\\]");
auto match = LINE_WITH_LEVEL.match(line);
@@ -343,11 +343,17 @@ MessageLevel::Enum LogParser::guessLevel(const QString& line)
return MessageLevel::Debug;
}
if (line.contains("Exception: ") || line.contains("Throwable: "))
return MessageLevel::Error;
if (line.startsWith("Caused by: ") || line.startsWith("Exception in thread"))
return MessageLevel::Error;
if (line.contains("overwriting existing"))
return MessageLevel::Fatal;
if (line == "---- Minecraft Crash Report ----")
return MessageLevel::Error;
if (line.startsWith("\t") || line.startsWith(" "))
return previous;
return MessageLevel::Unknown;
}