Allow enabling WXTRACE in release builds on all platforms

Setting the environment variable KICAD_ENABLE_WXTRACE now enables wx
trace logging on all platforms. MSW still requires its original
environment variables to be set to get the console displayed.
This commit is contained in:
Ian McInerney 2024-02-02 14:21:33 +00:00
parent 2b1bf369f2
commit d44b04978a
4 changed files with 34 additions and 0 deletions

View File

@ -176,6 +176,17 @@ struct APP_SINGLE_TOP : public wxApp
if( !KIPLATFORM::APP::Init() )
return false;
#ifndef DEBUG
// Enable logging traces to the console in release build.
// This is usually disabled, but it can be useful for users to run to help
// debug issues and other problems.
if( wxGetEnv( wxS( "KICAD_ENABLE_WXTRACE" ), nullptr ) )
{
wxLog::EnableLogging( true );
wxLog::SetLogLevel( wxLOG_Trace );
}
#endif
// Force wxHtmlWinParser initialization when a wxHtmlWindow is used only
// in a shared library (.so or .dll file)
// Otherwise the Html text is displayed as plain text.

View File

@ -450,6 +450,17 @@ struct APP_KICAD : public wxApp
if( !KIPLATFORM::APP::Init() )
return false;
#ifndef DEBUG
// Enable logging traces to the console in release build.
// This is usually disabled, but it can be useful for users to run to help
// debug issues and other problems.
if( wxGetEnv( wxS( "KICAD_ENABLE_WXTRACE" ), nullptr ) )
{
wxLog::EnableLogging( true );
wxLog::SetLogLevel( wxLOG_Trace );
}
#endif
if( !program.OnPgmInit() )
{
program.OnPgmExit();

View File

@ -479,6 +479,17 @@ struct APP_KICAD_CLI : public wxAppConsole
if( !KIPLATFORM::APP::Init() )
return false;
#ifndef DEBUG
// Enable logging traces to the console in release build.
// This is usually disabled, but it can be useful for users to run to help
// debug issues and other problems.
if( wxGetEnv( wxS( "KICAD_ENABLE_WXTRACE" ), nullptr ) )
{
wxLog::EnableLogging( true );
wxLog::SetLogLevel( wxLOG_Trace );
}
#endif
if( !program.OnPgmInit() )
{
program.OnPgmExit();

View File

@ -89,6 +89,7 @@ bool KIPLATFORM::APP::Init()
// It may be useful to log up to traces in a console, but in Release builds the log level changes to Info
// Also we have to force the active target to stderr or else it goes to the void
bool forceLog = wxGetEnv( wxS( "KICAD_FORCE_CONSOLE_TRACE" ), nullptr );
if( forceLog )
{
wxLog::EnableLogging( true );