Log debug output only in builds with debugSymbolsAndLogs

On master, easylogging's Debug level was disabled unless OVRAS was built
with debugSymbolsAndLogs (ENABLE_DEBUG_LOGGING). The qt6 branch switched
to qDebug() and lost that: debugLoggingEnabled was left unused, and all
debug output reached the log. On the Steam Frame it filled with
"updateAllPulseData done." about every 11 ms, as the audio tab reads the
microphone's mute state on every tick.

setUpLogging() now disables debug output through a logging filter rule.
QT_LOGGING_RULES="*.debug=true" takes precedence and turns it on again
for troubleshooting without a rebuild.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 23:32:00 +02:00
co-authored by Claude Opus 5.5
parent ec82b5fead
commit bbb3d1ba0e
2 changed files with 42 additions and 0 deletions
+10
View File
@@ -1,6 +1,7 @@
#include "setup.h"
#include <QtLogging>
#include <QtDebug>
#include <QLoggingCategory>
#ifdef ENABLE_DEBUG_LOGGING
constexpr auto debugLoggingEnabled = true;
#else
@@ -382,4 +383,13 @@ void setUpLogging()
f = fopen( "AdvancedSettings.log", "a" );
qSetMessagePattern("[%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{time process}: %{message}");
originalMessageHandler = qInstallMessageHandler( mainQtMessageHandler );
// Debug output only in builds with debugSymbolsAndLogs, as on master
// (easylogging's Debug level was disabled otherwise). Some qDebug() calls
// run on every tick (e.g. "updateAllPulseData done."). The environment
// variable QT_LOGGING_RULES="*.debug=true" takes precedence over this and
// turns them on again without a rebuild.
if constexpr ( !debugLoggingEnabled )
{
QLoggingCategory::setFilterRules( "*.debug=false" );
}
}