Add (optional) trace mask setting as advanced config option

Maximize laziness!
This does not affect the environment variable usage
This commit is contained in:
Marek Roszko 2021-10-07 21:04:51 -04:00
parent cb47bf25c0
commit 4377f8019d
1 changed files with 17 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include <wx/config.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/tokenzr.h>
/*
* Flag to enable advanced config debugging
@ -174,6 +175,8 @@ static const wxChar Skip3DModelMemoryCache[] = wxT( "Skip3DModelMemoryCache" );
static const wxChar HideVersionFromTitle[] = wxT( "HideVersionFromTitle" );
static const wxChar TraceMasks[] = wxT( "TraceMasks" );
} // namespace KEYS
@ -392,8 +395,22 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HideVersionFromTitle,
&m_HideVersionFromTitle, false ) );
// Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config
wxString traceMasks = "";
configParams.push_back( new PARAM_CFG_WXSTRING( true, AC_KEYS::TraceMasks, &traceMasks, "" ) );
// Load the config from file
wxConfigLoadSetups( &aCfg, configParams );
// Now actually set the trace masks
wxStringTokenizer traceMaskTokenizer( traceMasks, "," );
while( traceMaskTokenizer.HasMoreTokens() )
{
wxString mask = traceMaskTokenizer.GetNextToken();
wxLog::AddTraceMask( mask );
}
dumpCfg( configParams );
for( PARAM_CFG* param : configParams )