suppresses wxLogDebug() messages
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@329
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
m_ulTraceMask = (wxTraceMask)0; // -1 to set all bits
}
m_ulTraceMask = (wxTraceMask)0; // -1 to set all bits
}
-wxLog *wxLog::GetActiveTarget()
-{
+wxLog *wxLog::GetActiveTarget()
+{
if ( !ms_bInitialized ) {
// prevent infinite recursion if someone calls wxLogXXX() from
// wxApp::CreateLogTarget()
if ( !ms_bInitialized ) {
// prevent infinite recursion if someone calls wxLogXXX() from
// wxApp::CreateLogTarget()
// do nothing if it fails - what can we do?
}
// do nothing if it fails - what can we do?
}
}
wxLog *wxLog::SetActiveTarget(wxLog *pLogger)
}
wxLog *wxLog::SetActiveTarget(wxLog *pLogger)
// flush the old messages before changing
if ( ms_pLogger != NULL )
ms_pLogger->Flush();
ms_bInitialized = TRUE;
// flush the old messages before changing
if ( ms_pLogger != NULL )
ms_pLogger->Flush();
ms_bInitialized = TRUE;
- wxLog *pOldLogger = ms_pLogger;
- ms_pLogger = pLogger;
- return pOldLogger;
+ wxLog *pOldLogger = ms_pLogger;
+ ms_pLogger = pLogger;
+ return pOldLogger;
}
void wxLog::DoLog(wxLogLevel level, const char *szString)
}
void wxLog::DoLog(wxLogLevel level, const char *szString)
DoLogString(str << (level == wxLOG_Trace ? _("Trace") : _("Debug"))
<< ": " << szString);
#endif
DoLogString(str << (level == wxLOG_Trace ? _("Trace") : _("Debug"))
<< ": " << szString);
#endif
// concatenate all strings (but not too many to not overfill the msg box)
wxString str;
// concatenate all strings (but not too many to not overfill the msg box)
wxString str;
nMsgCount = m_aMessages.Count();
// start from the most recent message
nMsgCount = m_aMessages.Count();
// start from the most recent message
m_aMessages.Add(szString);
break;
m_aMessages.Add(szString);
break;
default:
wxFAIL_MSG("unknown log level in wxLogGui::DoLog");
}
default:
wxFAIL_MSG("unknown log level in wxLogGui::DoLog");
}
EVT_MENU(Menu_Clear, wxLogFrame::OnClear)
EVT_CLOSE(wxLogFrame::OnCloseWindow)
EVT_MENU(Menu_Clear, wxLogFrame::OnClear)
EVT_CLOSE(wxLogFrame::OnCloseWindow)
wxLogFrame::wxLogFrame(const char *szTitle)
: wxFrame(NULL, -1, szTitle)
wxLogFrame::wxLogFrame(const char *szTitle)
: wxFrame(NULL, -1, szTitle)
// retrieve text and save it
// -------------------------
// retrieve text and save it
// -------------------------
#ifdef __WXGTK__
// @@@@ TODO: no GetNumberOfLines and GetLineText in wxGTK yet
wxLogError("Sorry, this function is not implemented under GTK");
#ifdef __WXGTK__
// @@@@ TODO: no GetNumberOfLines and GetLineText in wxGTK yet
wxLogError("Sorry, this function is not implemented under GTK");
bOk = file.Write(m_pTextCtrl->GetLineText(nLine) + wxTextFile::GetEOL());
}
#endif //GTK
bOk = file.Write(m_pTextCtrl->GetLineText(nLine) + wxTextFile::GetEOL());
}
#endif //GTK
if ( bOk )
bOk = file.Close();
if ( bOk )
bOk = file.Close();
{
m_pOldLog = wxLog::GetActiveTarget();
m_pLogFrame = new wxLogFrame(szTitle);
{
m_pOldLog = wxLog::GetActiveTarget();
m_pLogFrame = new wxLogFrame(szTitle);
if ( bShow )
m_pLogFrame->Show(TRUE);
}
if ( bShow )
m_pLogFrame->Show(TRUE);
}
{
// first let the previous logger show it
if ( m_pOldLog != NULL ) {
{
// first let the previous logger show it
if ( m_pOldLog != NULL ) {
- // @@@ why can't we access protected wxLog method from here (we derive
+ // @@@ why can't we access protected wxLog method from here (we derive
// from wxLog)? gcc gives "DoLog is protected in this context", what
// does this mean? Anyhow, the cast is harmless and let's us do what
// we want.
((wxLogWindow *)m_pOldLog)->DoLog(level, szString);
}
// from wxLog)? gcc gives "DoLog is protected in this context", what
// does this mean? Anyhow, the cast is harmless and let's us do what
// we want.
((wxLogWindow *)m_pOldLog)->DoLog(level, szString);
}
// and this will format it nicely and call our DoLogString()
wxLog::DoLog(level, szString);
}
// and this will format it nicely and call our DoLogString()
wxLog::DoLog(level, szString);
}
// get error message from system
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
// get error message from system
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf,
0, NULL);
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf,
0, NULL);
- // send it to the normal log destination
- wxLogDebug(szBuf);
-
+ // send it to the normal log destination
+ wxLogDebug(szBuf);
+
strcat(szBuf, _("\nDo you want to stop the program?"
"\nYou can also choose [Cancel] to suppress "
"further warnings."));
strcat(szBuf, _("\nDo you want to stop the program?"
"\nYou can also choose [Cancel] to suppress "
"further warnings."));
case wxCANCEL:
s_bNoAsserts = TRUE;
break;
case wxCANCEL:
s_bNoAsserts = TRUE;
break;
//case wxNO: nothing to do
}
}
//case wxNO: nothing to do
}
}