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;
#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<wxString>::iterator it;
for ( it = tempFileVector.begin(); it != tempFileVector.end(); it++ )
wxRemoveFile ( *it );

View File

@ -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<wxHtmlEasyPrinting> htmlPrinting;