summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorDentomologist <dentomologist@gmail.com>2026-05-06 12:44:43 -0700
committerDentomologist <dentomologist@gmail.com>2026-05-06 12:44:43 -0700
commitdfda04c4e4729aba055721bb11bb495ba39827c4 (patch)
tree0365ac4887ba22ab17b034979ae92fca269a11bc /Source
parent6d5399246e2147217a8bf82892e22a5575f06293 (diff)
MsgHandler: Use log level matching MsgType for alerts
When calling `ShowMessageAlert` with a given `MsgType`, log the alert with a `LogLevel` matching the `MsgType` instead of always using `LogLevel::LERROR`.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/MsgHandler.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/Core/Common/MsgHandler.cpp b/Source/Core/Common/MsgHandler.cpp
index f6201c651f..d8e8c2e711 100644
--- a/Source/Core/Common/MsgHandler.cpp
+++ b/Source/Core/Common/MsgHandler.cpp
@@ -73,6 +73,19 @@ const char* GetCaption(MsgType style)
return "Unhandled caption";
}
}
+
+Log::LogLevel GetMessageAlertLogLevel(const MsgType style)
+{
+ switch (style)
+ {
+ case MsgType::Critical:
+ return Log::LogLevel::LERROR;
+ case MsgType::Warning:
+ return Log::LogLevel::LWARNING;
+ default:
+ return Log::LogLevel::LINFO;
+ }
+}
} // Anonymous namespace
// Select which of these functions that are used for message boxes. If
@@ -108,10 +121,10 @@ static bool ShowMessageAlert(std::string_view text, bool yes_no, Common::Log::Lo
MsgType style, const char* file, int line)
{
const char* caption = GetCaption(style);
+ const Log::LogLevel level = GetMessageAlertLogLevel(style);
// Directly call GenericLogFmt rather than using the normal log macros so that we can use the
// caller's line file and line number
- Common::Log::GenericLogFmt<2>(Common::Log::LogLevel::LERROR, log_type, file, line,
- FMT_STRING("{}: {}"), caption, text);
+ Common::Log::GenericLogFmt<2>(level, log_type, file, line, FMT_STRING("{}: {}"), caption, text);
// Panic alerts.
if (style == MsgType::Warning && s_abort_on_panic_alert)