void wxMessageOutputDebug::Printf(const wxChar* format, ...) { wxString out; va_list args; va_start(args, format); out.PrintfV(format, args); va_end(args); #if defined(__WXMSW__) && !defined(__WXMICROWIN__) out.Replace(wxT("\t"), wxT(" ")); out.Replace(wxT("\n"), wxT("\r\n")); ::OutputDebugString(out); #elif defined(__WXMAC__) && !defined(__DARWIN__) if ( wxIsDebuggerRunning() ) { Str255 pstr; wxString output = out + wxT(";g") ; wxMacStringToPascal(output.c_str(), pstr); #ifdef __powerc DebugStr(pstr); #else SysBreakStr(pstr); #endif } #else wxFputs( out , stderr ) ; if ( out.Right(1) != wxT("\n") ) wxFputs( wxT("\n") , stderr ) ; fflush( stderr ) ; #endif // platform }
void wxLogStderr::DoLogText(const wxString& msg) { wxFputs(msg + '\n', m_fp); fflush(m_fp); // under GUI systems such as Windows or Mac, programs usually don't have // stderr at all, so show the messages also somewhere else, typically in // the debugger window so that they go at least somewhere instead of being // simply lost if ( m_fp == stderr ) { wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; if ( traits && !traits->HasStderr() ) { wxMessageOutputDebug().Output(msg + wxS('\n')); } } }
void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) { wxString str; TimeStamp(&str); str << szString; wxFputs(str, m_fp); wxFputc(_T('\n'), m_fp); fflush(m_fp); // under GUI systems such as Windows or Mac, programs usually don't have // stderr at all, so show the messages also somewhere else, typically in // the debugger window so that they go at least somewhere instead of being // simply lost if ( m_fp == stderr ) { wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; if ( traits && !traits->HasStderr() ) { wxMessageOutputDebug dbgout; dbgout.Printf(_T("%s\n"), str.c_str()); } } }