From b464e10fdaa6d14e2b095317d26096c28987f1ea Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Mon, 3 Sep 2012 22:37:01 +0800 Subject: [PATCH] Enable debug log in GTK --- src/xmlcopyeditor.cpp | 16 ++++++---------- src/xmlcopyeditor.h | 4 +--- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 91b6daa..ee4c7c3 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -211,7 +211,7 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ), { lang = 0; -#ifdef __WXGTK__ +#if defined ( __WXGTK__ ) && !defined ( __WXDEBUG__ ) int fdnull = open ( "/dev/null", O_WRONLY, 0 ); dup2 ( fdnull, STDERR_FILENO ); #endif @@ -228,6 +228,11 @@ MyApp::~MyApp() bool MyApp::OnInit() { +#ifdef __WXDEBUG__ + wxLog::SetActiveTarget ( new wxLogStderr() ); + wxLog::SetLogLevel ( wxLOG_Max ); +#endif + int systemLocale = myLocale.GetSystemLanguage(); switch ( systemLocale ) { @@ -675,11 +680,6 @@ MyFrame::MyFrame ( mainBook ( 0 ), restoreFocusToNotebook ( false ) { -#ifdef __WXDEBUG__ - wxLog::SetActiveTarget ( &logTarget ); - wxLog::SetLogLevel ( wxLOG_Max ); -#endif - manager.SetManagedWindow ( this ); lastPos = 0; @@ -1094,10 +1094,6 @@ MyFrame::MyFrame ( MyFrame::~MyFrame() { -#ifdef __WXDEBUG__ - wxLog::SetActiveTarget ( NULL ); -#endif - std::vector::iterator it; for ( it = tempFileVector.begin(); it != tempFileVector.end(); it++ ) wxRemoveFile ( *it ); diff --git a/src/xmlcopyeditor.h b/src/xmlcopyeditor.h index fa228a5..11a19f4 100755 --- a/src/xmlcopyeditor.h +++ b/src/xmlcopyeditor.h @@ -350,9 +350,7 @@ class MyFrame : public wxFrame wxLocale& myLocale; bool singleInstanceCheck; int lang, lastPos; -#ifdef __WXDEBUG__ - wxLogStderr logTarget; -#else +#ifndef __WXDEBUG__ wxLogNull logTarget; #endif std::auto_ptr htmlPrinting;