MGR: Setup an assert handler under the wxWidgets 3.x framework, log output to the log file on release builds.

This commit is contained in:
Rom Walton 2014-03-05 12:08:56 -05:00
parent 68d844aea6
commit 1ee90f063e
1 changed files with 17 additions and 0 deletions

View File

@ -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"));