git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49410
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#endif
// log a message indicating the number of times the previous message was
#endif
// log a message indicating the number of times the previous message was
- // repeated; only does something if ms_prevCounter > 0
- static void LogLastRepetitionCountIfNeeded();
+ // repeated if ms_prevCounter > 0, does nothing otherwise; return the old
+ // value of ms_prevCounter
+ static unsigned LogLastRepetitionCountIfNeeded();
private:
// static variables
private:
// static variables
// ----------------------------------------------------------------------------
/* static */
// ----------------------------------------------------------------------------
/* static */
-void wxLog::LogLastRepetitionCountIfNeeded()
+unsigned wxLog::LogLastRepetitionCountIfNeeded()
{
wxCRIT_SECT_LOCKER(lock, ms_prevCS);
{
wxCRIT_SECT_LOCKER(lock, ms_prevCS);
+ const unsigned count = ms_prevCounter;
+
wxLog *pLogger = GetActiveTarget();
if ( pLogger && ms_prevCounter )
{
wxLog *pLogger = GetActiveTarget();
if ( pLogger && ms_prevCounter )
{
ms_prevString.clear();
pLogger->DoLog(ms_prevLevel, msg, ms_prevTimeStamp);
}
ms_prevString.clear();
pLogger->DoLog(ms_prevLevel, msg, ms_prevTimeStamp);
}
// static variables
// ----------------------------------------------------------------------------
// static variables
// ----------------------------------------------------------------------------
+#if wxUSE_THREADS
+wxCriticalSection wxLog::ms_prevCS;
+#endif // wxUSE_THREADS
bool wxLog::ms_bRepetCounting = false;
wxString wxLog::ms_prevString;
unsigned int wxLog::ms_prevCounter = 0;
bool wxLog::ms_bRepetCounting = false;
wxString wxLog::ms_prevString;
unsigned int wxLog::ms_prevCounter = 0;
// do it right now to block any new calls to Flush() while we're here
m_bHasMessages = false;
// do it right now to block any new calls to Flush() while we're here
m_bHasMessages = false;
- unsigned repeatCount = 0;
- if ( wxLog::GetRepetitionCounting() )
- {
- repeatCount = wxLog::DoLogNumberOfRepeats();
- }
+ const unsigned repeatCount = wxLog::LogLastRepetitionCountIfNeeded();
wxString appName = wxTheApp->GetAppDisplayName();
wxString appName = wxTheApp->GetAppDisplayName();
#if wxUSE_LOG_DIALOG
if ( repeatCount > 0 )
#if wxUSE_LOG_DIALOG
if ( repeatCount > 0 )
- m_aMessages[nMsgCount-1] += wxString::Format(wxT(" (%s)"), m_aMessages[nMsgCount-2].c_str());
+ {
+ m_aMessages[nMsgCount - 1]
+ << " (" << m_aMessages[nMsgCount - 2] << ")";
+ }
+
wxLogDialog dlg(NULL,
m_aMessages, m_aSeverity, m_aTimes,
title, style);
wxLogDialog dlg(NULL,
m_aMessages, m_aSeverity, m_aTimes,
title, style);