Enable debug log in GTK

This commit is contained in:
Zane U. Ji 2012-09-03 22:37:01 +08:00
parent b4aa69c2ca
commit b464e10fda
2 changed files with 7 additions and 13 deletions

View File

@ -211,7 +211,7 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
{ {
lang = 0; lang = 0;
#ifdef __WXGTK__ #if defined ( __WXGTK__ ) && !defined ( __WXDEBUG__ )
int fdnull = open ( "/dev/null", O_WRONLY, 0 ); int fdnull = open ( "/dev/null", O_WRONLY, 0 );
dup2 ( fdnull, STDERR_FILENO ); dup2 ( fdnull, STDERR_FILENO );
#endif #endif
@ -228,6 +228,11 @@ MyApp::~MyApp()
bool MyApp::OnInit() bool MyApp::OnInit()
{ {
#ifdef __WXDEBUG__
wxLog::SetActiveTarget ( new wxLogStderr() );
wxLog::SetLogLevel ( wxLOG_Max );
#endif
int systemLocale = myLocale.GetSystemLanguage(); int systemLocale = myLocale.GetSystemLanguage();
switch ( systemLocale ) switch ( systemLocale )
{ {
@ -675,11 +680,6 @@ MyFrame::MyFrame (
mainBook ( 0 ), mainBook ( 0 ),
restoreFocusToNotebook ( false ) restoreFocusToNotebook ( false )
{ {
#ifdef __WXDEBUG__
wxLog::SetActiveTarget ( &logTarget );
wxLog::SetLogLevel ( wxLOG_Max );
#endif
manager.SetManagedWindow ( this ); manager.SetManagedWindow ( this );
lastPos = 0; lastPos = 0;
@ -1094,10 +1094,6 @@ MyFrame::MyFrame (
MyFrame::~MyFrame() MyFrame::~MyFrame()
{ {
#ifdef __WXDEBUG__
wxLog::SetActiveTarget ( NULL );
#endif
std::vector<wxString>::iterator it; std::vector<wxString>::iterator it;
for ( it = tempFileVector.begin(); it != tempFileVector.end(); it++ ) for ( it = tempFileVector.begin(); it != tempFileVector.end(); it++ )
wxRemoveFile ( *it ); wxRemoveFile ( *it );

View File

@ -350,9 +350,7 @@ class MyFrame : public wxFrame
wxLocale& myLocale; wxLocale& myLocale;
bool singleInstanceCheck; bool singleInstanceCheck;
int lang, lastPos; int lang, lastPos;
#ifdef __WXDEBUG__ #ifndef __WXDEBUG__
wxLogStderr logTarget;
#else
wxLogNull logTarget; wxLogNull logTarget;
#endif #endif
std::auto_ptr<wxHtmlEasyPrinting> htmlPrinting; std::auto_ptr<wxHtmlEasyPrinting> htmlPrinting;