Make Enable Logging the master switch over all verbose logging

The verbose toggles (MPV, remote control) kept working with the master
"Enable Logging" toggle off: the settings UI hides them, but their
stored values - verboseMPVLogging is even iCloud-synced - were still
honored at runtime, producing console output and enabling the periodic
MPV stats collection while logging appeared disabled.

Enable Logging now takes precedence everywhere:

- LoggingService gates its DEBUG-build OSLog console output on the
  master toggle (it previously ran before the isEnabled guard, so the
  Xcode console was never silent)
- MPVLogging requires loggingEnabled && verboseMPVLogging, which also
  gates the 10s playback stats task via MPVLogging.verboseEnabled
- rcDebug in LocalNetworkService and RemoteControlCoordinator requires
  the master toggle alongside verboseRemoteControlLogging
This commit is contained in:
Arkadiusz Fal
2026-07-19 01:00:01 +02:00
parent 6aa5fd8ee7
commit 9c97036684
4 changed files with 27 additions and 15 deletions

View File

@@ -37,8 +37,11 @@ enum MPVLogging {
if now - _lastCheckTime > cacheDurationNanos {
_lastCheckTime = now
// Read from UserDefaults directly for thread safety
// (SettingsManager is @MainActor)
_cachedIsEnabled = UserDefaults.standard.bool(forKey: "verboseMPVLogging")
// (SettingsManager is @MainActor).
// The master "Enable Logging" switch takes precedence: with it off,
// verbose MPV logging is off no matter what the verbose flag says.
_cachedIsEnabled = UserDefaults.standard.bool(forKey: "loggingEnabled")
&& UserDefaults.standard.bool(forKey: "verboseMPVLogging")
}
return _cachedIsEnabled