Add --loglevel argument for command line log level control

Introduce support for setting the application's log level via a new --loglevel command line argument.
Log level is parsed early in initialization and can be set to DISABLED, ERROR, WARNING, INFO, or DEBUG (case-insensitive).
The RILogLevel enum now includes a DISABLED value.
Logger initialization in both console and GUI applications now respects the command line log level if provided, otherwise defaults to preference-based settings.

Fixes by clang-format
This commit is contained in:
Magne Sjaastad committed 2026-01-23 13:31:58 +01:00
1 parent fde113259a
commit 30793beef2
7 files changed
+81 -7

No files matched your search

@@ -462,7 +462,16 @@ void RiaGuiApplication::initialize()
auto logger = std::make_unique<RiuMessagePanelLogger>();
logger->addMessagePanel( m_mainWindow->messagePanel() );
logger->addMessagePanel( m_mainPlotWindow->messagePanel() );
logger->setLevel( int( RiaLogging::logLevelBasedOnPreferences() ) );
// Use command line log level if provided, otherwise use preference-based level
if ( m_logLevelFromCommandLine.has_value() )
{
logger->setLevel( m_logLevelFromCommandLine.value() );
}
else
{
logger->setLevel( int( RiaLogging::logLevelBasedOnPreferences() ) );
}
RiaLogging::appendLoggerInstance( std::move( logger ) );
}