From 1e8a4bc241f0031d538a3ea474211b9840ca2bd8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Mar 1999 22:03:06 +0000 Subject: [PATCH] wxLogStderr sends output to debugger too under Windows git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/log.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/common/log.cpp b/src/common/log.cpp index c1e68f3467..aa30e87e1a 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -387,9 +387,17 @@ wxLogStderr::wxLogStderr(FILE *fp) void wxLogStderr::DoLogString(const char *szString) { - fputs(szString, m_fp); - fputc('\n', m_fp); + wxString str(szString); + str << '\n'; + + fputs(str, m_fp); fflush(m_fp); + + // under Windows, programs usually don't have stderr at all, so make show the + // messages also under debugger +#ifdef __WXMSW__ + OutputDebugString(str + '\r'); +#endif // MSW } // ---------------------------------------------------------------------------- @@ -524,18 +532,14 @@ void wxLogGui::DoLog(wxLogLevel level, const char *szString) OutputDebugString(strTime + szString + "\n\r"); #else // send them to stderr - /* fprintf(stderr, "%s %s: %s\n", strTime.c_str(), - level == wxLOG_Trace ? _("Trace") : _("Debug"), - szString); - */ - fprintf(stderr, "%s\n", + level == wxLOG_Trace ? "Trace" : "Debug", szString); fflush(stderr); #endif } - #endif + #endif // __WXDEBUG__ break; case wxLOG_FatalError: @@ -984,6 +988,8 @@ void wxOnAssert(const char *szFile, int nLine, const char *szMsg) // He-e-e-e-elp!! we're trapped in endless loop Trap(); + s_bInAssert = FALSE; + return; } -- 2.45.2