From 1ee90f063ef5168ccc67bbe6ca64ca861d9879d7 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Wed, 5 Mar 2014 12:08:56 -0500 Subject: [PATCH] MGR: Setup an assert handler under the wxWidgets 3.x framework, log output to the log file on release builds. --- clientgui/BOINCGUIApp.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 6e0dfc61da..616df1238b 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -107,6 +107,19 @@ OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt #endif +void BOINCAssertHandler(const wxString &file, int line, const wxString &func, const wxString &cond, const wxString &msg) { + wxLogTrace( + wxT("Assert"), + wxT("ASSERT: %s:%d - %s - %s - %s"), + file.c_str(), + line, + func.c_str(), + cond.c_str(), + msg.c_str() + ); +} + + bool CBOINCGUIApp::OnInit() { // Initialize globals #ifdef SANDBOX @@ -255,11 +268,15 @@ bool CBOINCGUIApp::OnInit() { "stderrgui" ); +#ifdef _NDEBUG + wxSetAssertHandler(BOINCAssertHandler); +#endif // Enable Logging and Trace Masks m_pLog = new wxLogBOINC(); wxLog::SetActiveTarget(m_pLog); + m_pLog->AddTraceMask(wxT("Assert")); m_pLog->AddTraceMask(wxT("Function Start/End")); m_pLog->AddTraceMask(wxT("Function Status"));