mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-11 13:36:24 +02:00
Merge pull request #14028 from glebm/fix-log-flags-2
Only force the log level if it set via an argv
This commit is contained in:
1 file changed
+11
-4
+11
-4
@@ -560,18 +560,24 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
|
||||
// Parse command line
|
||||
LogTypes::LOG_LEVELS logLevel = LogTypes::LINFO;
|
||||
bool forceLogLevel = false;
|
||||
const auto setLogLevel = [&logLevel, &forceLogLevel](LogTypes::LOG_LEVELS level) {
|
||||
logLevel = level;
|
||||
forceLogLevel = true;
|
||||
};
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
switch (argv[i][1]) {
|
||||
case 'd':
|
||||
// Enable debug logging
|
||||
// Note that you must also change the max log level in Log.h.
|
||||
logLevel = LogTypes::LDEBUG;
|
||||
setLogLevel(LogTypes::LDEBUG);
|
||||
break;
|
||||
case 'v':
|
||||
// Enable verbose logging
|
||||
// Note that you must also change the max log level in Log.h.
|
||||
logLevel = LogTypes::LVERBOSE;
|
||||
setLogLevel(LogTypes::LVERBOSE);
|
||||
break;
|
||||
case 'j':
|
||||
g_Config.iCpuCore = (int)CPUCore::JIT;
|
||||
@@ -587,7 +593,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
break;
|
||||
case '-':
|
||||
if (!strncmp(argv[i], "--loglevel=", strlen("--loglevel=")) && strlen(argv[i]) > strlen("--loglevel="))
|
||||
logLevel = static_cast<LogTypes::LOG_LEVELS>(std::atoi(argv[i] + strlen("--loglevel=")));
|
||||
setLogLevel(static_cast<LogTypes::LOG_LEVELS>(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="))
|
||||
@@ -668,7 +674,8 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
if (fileToLog)
|
||||
LogManager::GetInstance()->ChangeFileLog(fileToLog);
|
||||
|
||||
LogManager::GetInstance()->SetAllLogLevels(logLevel);
|
||||
if (forceLogLevel)
|
||||
LogManager::GetInstance()->SetAllLogLevels(logLevel);
|
||||
|
||||
PostLoadConfig();
|
||||
|
||||
|
||||
Reference in new issue
Block a user