use LogLastRepetitionCountIfNeeded() instead of DoLogNumberOfRepeats() in logg.cpp too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -304,8 +304,9 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// log a message indicating the number of times the previous message was
|
// log a message indicating the number of times the previous message was
|
||||||
// repeated; only does something if ms_prevCounter > 0
|
// repeated if ms_prevCounter > 0, does nothing otherwise; return the old
|
||||||
static void LogLastRepetitionCountIfNeeded();
|
// value of ms_prevCounter
|
||||||
|
static unsigned LogLastRepetitionCountIfNeeded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// static variables
|
// static variables
|
||||||
|
@@ -458,10 +458,12 @@ void WXDLLEXPORT wxVLogSysError(unsigned long err, const wxString& format, va_li
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/* 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();
|
wxLog *pLogger = GetActiveTarget();
|
||||||
if ( pLogger && ms_prevCounter )
|
if ( pLogger && ms_prevCounter )
|
||||||
{
|
{
|
||||||
@@ -479,6 +481,8 @@ void wxLog::LogLastRepetitionCountIfNeeded()
|
|||||||
ms_prevString.clear();
|
ms_prevString.clear();
|
||||||
pLogger->DoLog(ms_prevLevel, msg, ms_prevTimeStamp);
|
pLogger->DoLog(ms_prevLevel, msg, ms_prevTimeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLog::~wxLog()
|
wxLog::~wxLog()
|
||||||
@@ -904,6 +908,9 @@ wxLogInterposerTemp::wxLogInterposerTemp()
|
|||||||
// static variables
|
// static variables
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_THREADS
|
||||||
|
wxCriticalSection wxLog::ms_prevCS;
|
||||||
|
#endif // wxUSE_THREADS
|
||||||
bool wxLog::ms_bRepetCounting = false;
|
bool wxLog::ms_bRepetCounting = false;
|
||||||
wxString wxLog::ms_prevString;
|
wxString wxLog::ms_prevString;
|
||||||
unsigned int wxLog::ms_prevCounter = 0;
|
unsigned int wxLog::ms_prevCounter = 0;
|
||||||
|
@@ -275,11 +275,7 @@ void wxLogGui::Flush()
|
|||||||
// do it right now to block any new calls to Flush() while we're here
|
// do it right now to block any new calls to Flush() while we're here
|
||||||
m_bHasMessages = false;
|
m_bHasMessages = false;
|
||||||
|
|
||||||
unsigned repeatCount = 0;
|
const unsigned repeatCount = wxLog::LogLastRepetitionCountIfNeeded();
|
||||||
if ( wxLog::GetRepetitionCounting() )
|
|
||||||
{
|
|
||||||
repeatCount = wxLog::DoLogNumberOfRepeats();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString appName = wxTheApp->GetAppDisplayName();
|
wxString appName = wxTheApp->GetAppDisplayName();
|
||||||
|
|
||||||
@@ -317,7 +313,11 @@ void wxLogGui::Flush()
|
|||||||
#if wxUSE_LOG_DIALOG
|
#if wxUSE_LOG_DIALOG
|
||||||
|
|
||||||
if ( repeatCount > 0 )
|
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,
|
wxLogDialog dlg(NULL,
|
||||||
m_aMessages, m_aSeverity, m_aTimes,
|
m_aMessages, m_aSeverity, m_aTimes,
|
||||||
title, style);
|
title, style);
|
||||||
|
Reference in New Issue
Block a user