Add env var to force logging on msw

(cherry picked from commit 18dd623122)
This commit is contained in:
Marek Roszko 2023-05-04 20:56:50 -04:00 committed by Mark Roszko
parent 34d5f1f9fe
commit a6b23a751e
1 changed files with 14 additions and 0 deletions

View File

@ -67,6 +67,8 @@ bool KIPLATFORM::APP::Init()
{
#if !defined( __MINGW32__ ) // These redirections create problems on mingw:
// Nothing is printed to the console
if( GetStdHandle( STD_INPUT_HANDLE ) != INVALID_HANDLE_VALUE )
{
freopen( "CONIN$", "r", stdin );
@ -96,6 +98,18 @@ bool KIPLATFORM::APP::Init()
std::cin.clear();
}
// 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 );
#ifndef DEBUG
wxLog::SetLogLevel( wxLOG_Trace );
#endif;
wxLog::SetActiveTarget( new wxLogStderr );
}
return true;
}