X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2e7f384517ccb08cec87dd233c8f11f876b65e5c..63e02796620637b50a96d74a2264f3dea8def866:/src/common/log.cpp diff --git a/src/common/log.cpp b/src/common/log.cpp index affdec61cb..0687124fe8 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -37,6 +37,7 @@ #endif //WX_PRECOMP #include "wx/apptrait.h" +#include "wx/datetime.h" #include "wx/file.h" #include "wx/msgout.h" #include "wx/textfile.h" @@ -328,7 +329,7 @@ void wxLog::OnLog(wxLogLevel level, const wxChar *szString, time_t t) { if ( GetRepetitionCounting() ) { - pLogger->DoLogNumberOfRepeats(); + DoLogNumberOfRepeats(); } ms_prevString = szString; ms_prevLevel = level; @@ -340,11 +341,15 @@ void wxLog::OnLog(wxLogLevel level, const wxChar *szString, time_t t) } // deprecated function +#if WXWIN_COMPATIBILITY_2_6 + wxChar *wxLog::SetLogBuffer(wxChar * WXUNUSED(buf), size_t WXUNUSED(size)) { return NULL; } +#endif // WXWIN_COMPATIBILITY_2_6 + wxLog *wxLog::GetActiveTarget() { if ( ms_bAutoCreate && ms_pLogger == NULL ) { @@ -407,16 +412,21 @@ void wxLog::ClearTraceMasks() void wxLog::TimeStamp(wxString *str) { +#if wxUSE_DATETIME if ( ms_timestamp ) { wxChar buf[256]; time_t timeNow; (void)time(&timeNow); - wxStrftime(buf, WXSIZEOF(buf), ms_timestamp, localtime(&timeNow)); + + struct tm tm; + wxStrftime(buf, WXSIZEOF(buf), + ms_timestamp, wxLocaltime_r(&timeNow, &tm)); str->Empty(); *str << buf << wxT(": "); } +#endif // wxUSE_DATETIME } void wxLog::DoLog(wxLogLevel level, const wxChar *szString, time_t t) @@ -545,8 +555,8 @@ void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) TimeStamp(&str); str << szString; - fputs(str.mb_str(), m_fp); - fputc(_T('\n'), m_fp); + 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