From f372a2112bc6088ceda7c53f83f852f5085dae75 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 30 Jan 2021 16:08:29 +0000 Subject: [PATCH] Fix logging flags 1. The logging flags were being ignored (-v, -d) 2. Adds a `--loglevel` argument. Useful when using the debug build for ASAN/UBSAN to hide extremely noisy debug messages. --- UI/NativeApp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index fd1133b415..148d602685 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -585,6 +586,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch g_Config.bSaveSettings = false; break; case '-': + if (!strncmp(argv[i], "--loglevel=", strlen("--loglevel=")) && strlen(argv[i]) > strlen("--loglevel=")) + logLevel = static_cast(std::atoi(argv[i] + strlen("--loglevel="))); if (!strncmp(argv[i], "--log=", strlen("--log=")) && strlen(argv[i]) > strlen("--log=")) fileToLog = argv[i] + strlen("--log="); if (!strncmp(argv[i], "--state=", strlen("--state=")) && strlen(argv[i]) > strlen("--state=")) @@ -665,6 +668,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch if (fileToLog) LogManager::GetInstance()->ChangeFileLog(fileToLog); + LogManager::GetInstance()->SetAllLogLevels(logLevel); + PostLoadConfig(); #if PPSSPP_PLATFORM(ANDROID)