Do our best to show messages logged during program startup/shutdown.
Use wxMessageOutputBest to show them even under Windows where programs usually don't have stderr at all and also don't disable log target auto-creation during shutdown as it's arguably better to leak memory (which shouldn't matter much when the program is about to exit anyhow) than to not show possibly important messages. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61450 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -165,6 +165,25 @@ PreviousLogInfo gs_prevLog;
|
||||
// NB: all accesses to it must be protected by GetLevelsCS() critical section
|
||||
WX_DEFINE_GLOBAL_VAR(wxStringToNumHashMap, ComponentLevels);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxLogOutputBest: wxLog wrapper around wxMessageOutputBest
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxLogOutputBest : public wxLog
|
||||
{
|
||||
public:
|
||||
wxLogOutputBest() { }
|
||||
|
||||
protected:
|
||||
virtual void DoLogText(const wxString& msg)
|
||||
{
|
||||
wxMessageOutputBest().Output(msg);
|
||||
}
|
||||
|
||||
private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxLogOutputBest);
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// ============================================================================
|
||||
@@ -481,7 +500,7 @@ wxLog *wxLog::GetMainThreadActiveTarget()
|
||||
if ( wxTheApp != NULL )
|
||||
ms_pLogger = wxTheApp->GetTraits()->CreateLogTarget();
|
||||
else
|
||||
ms_pLogger = new wxLogStderr;
|
||||
ms_pLogger = new wxLogOutputBest;
|
||||
|
||||
s_bInGetActiveTarget = false;
|
||||
|
||||
|
Reference in New Issue
Block a user