lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6147] Don't redirect all wxLog messages to stderr, just t


From: Greg Chicares
Subject: [lmi-commits] [6147] Don't redirect all wxLog messages to stderr, just the debug ones
Date: Thu, 26 Mar 2015 22:57:16 +0000

Revision: 6147
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6147
Author:   chicares
Date:     2015-03-26 22:57:15 +0000 (Thu, 26 Mar 2015)
Log Message:
-----------
Don't redirect all wxLog messages to stderr, just the debug ones

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/skeleton.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-03-26 22:50:31 UTC (rev 6146)
+++ lmi/trunk/ChangeLog 2015-03-26 22:57:15 UTC (rev 6147)
@@ -35913,6 +35913,12 @@
   wx_test_benchmark_census.cpp
   wx_test_default_input.cpp
   wx_test_expiry_dates.cpp
-Use wxPrintf() instead of wxLogMessage() for GUI test.
+Use wxPrintf() instead of wxLogMessage() for GUI test. See:
   http://lists.nongnu.org/archive/html/lmi/2015-03/msg00026.html
 
+20150326T2257Z <address@hidden> [516]
+
+  skeleton.cpp
+Don't redirect all wxLog messages to stderr, just the debug ones. See:
+  http://lists.nongnu.org/archive/html/lmi/2015-03/msg00026.html
+

Modified: lmi/trunk/skeleton.cpp
===================================================================
--- lmi/trunk/skeleton.cpp      2015-03-26 22:50:31 UTC (rev 6146)
+++ lmi/trunk/skeleton.cpp      2015-03-26 22:57:15 UTC (rev 6147)
@@ -91,13 +91,13 @@
 #include <wx/artprov.h>
 #include <wx/config.h>
 #include <wx/cshelp.h>
-#include <wx/debug.h>                   // wxIsDebuggerRunning()
 #include <wx/docmdi.h>
 #include <wx/image.h>
 #include <wx/log.h>                     // wxSafeShowMessage()
 #include <wx/math.h>                    // wxRound()
 #include <wx/menu.h>
 #include <wx/msgdlg.h>
+#include <wx/msgout.h>
 #include <wx/textctrl.h>
 #include <wx/textdlg.h>                 // wxGetTextFromUser()
 #include <wx/toolbar.h>
@@ -634,11 +634,39 @@
 {
     try
         {
-        if(!wxIsDebuggerRunning())
-            {
-            wxLog::SetActiveTarget(new wxLogStderr);
-            }
+#if defined __WXMSW__
+        // Send log messages of debug (and trace, which are roughly equivalent
+        // to debug) severity, which are usually not shown at all under MSW, to
+        // stderr.
+        //
+        // The end users wouldn't see them there as they don't run the program
+        // from a terminal, but they could be potentially valuable to the
+        // developers.
+        struct DebugStderrLog : wxLogInterposer
+        {
+            virtual void DoLogTextAtLevel(wxLogLevel level, wxString const& 
msg)
+                {
+                switch(level)
+                    {
+                    case wxLOG_FatalError:
+                    case wxLOG_Error:
+                    case wxLOG_Warning:
+                    case wxLOG_Message:
+                    case wxLOG_Status:
+                    case wxLOG_Info:
+                        break;
 
+                    case wxLOG_Debug:
+                    case wxLOG_Trace:
+                        wxMessageOutputStderr().Output(msg);
+                        break;
+                    }
+                }
+        };
+
+        wxLog::SetActiveTarget(new DebugStderrLog);
+#endif // defined __WXMSW__
+
         if(false == ProcessCommandLine(argc, argv))
             {
             return false;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]