mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-17 03:14:34 +01:00
Don't save log levels set from the command line
--loglevel, -d and -v are applied to the channels directly, and the next config save wrote them to [Log], permanently replacing the user's levels. The other command line options avoid this with DoNotSaveSetting. The debugger had the same problem and a flag for it. Generalize that one (NotifyChannelsChangedByDebugger -> DoNotSaveChannels) and set it here too. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
ea9be99149
commit
ce19265949
4 files changed
+10
-8
No files matched your search
@@ -223,9 +223,9 @@ void LogManager::SetFileLogPath(const Path &filename) {
|
||||
}
|
||||
|
||||
void LogManager::SaveConfig(Section *section) {
|
||||
if (channelsChangedByDebugger_) {
|
||||
if (doNotSaveChannels_) {
|
||||
// Leave the section as whatever was already on disk - see the doc comment on
|
||||
// NotifyChannelsChangedByDebugger().
|
||||
// DoNotSaveChannels().
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) {
|
||||
|
||||
@@ -174,10 +174,11 @@ public:
|
||||
void SaveConfig(Section *section);
|
||||
void LoadConfig(const Section *section);
|
||||
|
||||
// Channel level/enabled changes made through the WebSocket debugger (log.channel.set) are
|
||||
// meant as temporary, session-only diagnostic tweaks - call this so SaveConfig() skips
|
||||
// writing (and thus permanently overwriting) the user's real saved settings with them.
|
||||
void NotifyChannelsChangedByDebugger() { channelsChangedByDebugger_ = true; }
|
||||
// Channel level/enabled changes made through the WebSocket debugger (log.channel.set) or the
|
||||
// command line (--loglevel, -d, -v) are meant as temporary, session-only diagnostic tweaks -
|
||||
// call this so SaveConfig() skips writing (and thus permanently overwriting) the user's real
|
||||
// saved settings with them. Like Config::DoNotSaveSetting, but for all the channels.
|
||||
void DoNotSaveChannels() { doNotSaveChannels_ = true; }
|
||||
|
||||
static const char *GetLogTypeName(Log type);
|
||||
|
||||
@@ -199,7 +200,7 @@ private:
|
||||
void operator=(const LogManager &) = delete;
|
||||
|
||||
bool initialized_ = false;
|
||||
bool channelsChangedByDebugger_ = false;
|
||||
bool doNotSaveChannels_ = false;
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
ConsoleListener *consoleLog_ = nullptr;
|
||||
|
||||
@@ -583,6 +583,7 @@ void CommandLineOptions::ApplyToConfig() const {
|
||||
|
||||
if (logLevel.has_value()) {
|
||||
g_logManager.SetAllLogLevels(logLevel.value());
|
||||
g_logManager.DoNotSaveChannels();
|
||||
}
|
||||
|
||||
if (oldAtrac.has_value()) {
|
||||
|
||||
@@ -121,7 +121,7 @@ void WebSocketLogChannelSet(DebuggerRequest &req) {
|
||||
|
||||
// These are meant as temporary, session-only diagnostic tweaks - make sure they never
|
||||
// get written back over the user's actual saved log settings.
|
||||
g_logManager.NotifyChannelsChangedByDebugger();
|
||||
g_logManager.DoNotSaveChannels();
|
||||
if (hasLevel)
|
||||
g_logManager.SetLogLevel(type, level);
|
||||
if (hasEnabled)
|
||||
|
||||
Reference in new issue
Block a user