// wxLog class implementation
// ----------------------------------------------------------------------------
-/* static */
-void wxLog::LogLastRepetitionCountIfNeeded()
+unsigned wxLog::LogLastRepetitionCountIfNeeded()
{
- wxLog *pLogger = GetActiveTarget();
- if ( pLogger && ms_prevCounter )
+ wxCRIT_SECT_LOCKER(lock, ms_prevCS);
+
+ const unsigned count = ms_prevCounter;
+
+ if ( ms_prevCounter )
{
wxString msg;
#if wxUSE_INTL
#endif
ms_prevCounter = 0;
ms_prevString.clear();
- pLogger->DoLog(ms_prevLevel, msg, ms_prevTimeStamp);
+ DoLog(ms_prevLevel, msg, ms_prevTimeStamp);
}
+
+ return count;
}
wxLog::~wxLog()
{
if ( GetRepetitionCounting() )
{
+ wxCRIT_SECT_LOCKER(lock, ms_prevCS);
+
if ( szString == ms_prevString )
{
ms_prevCounter++;
return;
}
- LogLastRepetitionCountIfNeeded();
+ pLogger->LogLastRepetitionCountIfNeeded();
// reset repetition counter for a new message
ms_prevString = szString;
// 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;