]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/log.cpp
Fix numpad Del not working in wxRTC
[wxWidgets.git] / src / common / log.cpp
index e0e0c03eea68b5e2304af01349333315810f9d0f..da627fec24e600457254e9747375766457419b91 100644 (file)
@@ -165,6 +165,25 @@ PreviousLogInfo gs_prevLog;
 // NB: all accesses to it must be protected by GetLevelsCS() critical section
 WX_DEFINE_GLOBAL_VAR(wxStringToNumHashMap, ComponentLevels);
 
+// ----------------------------------------------------------------------------
+// wxLogOutputBest: wxLog wrapper around wxMessageOutputBest
+// ----------------------------------------------------------------------------
+
+class wxLogOutputBest : public wxLog
+{
+public:
+    wxLogOutputBest() { }
+
+protected:
+    virtual void DoLogText(const wxString& msg)
+    {
+        wxMessageOutputBest().Output(msg);
+    }
+
+private:
+    wxDECLARE_NO_COPY_CLASS(wxLogOutputBest);
+};
+
 } // anonymous namespace
 
 // ============================================================================
@@ -331,9 +350,7 @@ wxLog::CallDoLogNow(wxLogLevel level,
     wxUIntPtr num = 0;
     if ( info.GetNumValue(wxLOG_KEY_SYS_ERROR_CODE, &num) )
     {
-        long err = static_cast<long>(num);
-        if ( !err )
-            err = wxSysErrorCode();
+        const long err = static_cast<long>(num);
 
         suffix.Printf(_(" (error %ld: %s)"), err, wxSysErrorMsg(err));
     }
@@ -362,7 +379,9 @@ void wxLog::DoLogRecord(wxLogLevel level,
     // but to call both of them
     DoLog(level, (const char*)msg.mb_str(), info.timestamp);
     DoLog(level, (const wchar_t*)msg.wc_str(), info.timestamp);
-#endif // WXWIN_COMPATIBILITY_2_8
+#else // !WXWIN_COMPATIBILITY_2_8
+    wxUnusedVar(info);
+#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8
 
 
     // TODO: it would be better to extract message formatting in a separate
@@ -481,7 +500,7 @@ wxLog *wxLog::GetMainThreadActiveTarget()
             if ( wxTheApp != NULL )
                 ms_pLogger = wxTheApp->GetTraits()->CreateLogTarget();
             else
-                ms_pLogger = new wxLogStderr;
+                ms_pLogger = new wxLogOutputBest;
 
             s_bInGetActiveTarget = false;