don't recreate wxLog target from ~wxLog (adaptation of changes in trunk r49587)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -263,8 +263,7 @@ protected:
|
|||||||
virtual void DoLogString(const wxChar *szString, time_t t);
|
virtual void DoLogString(const wxChar *szString, time_t t);
|
||||||
|
|
||||||
// log a line containing the number of times the previous message was
|
// log a line containing the number of times the previous message was
|
||||||
// repeated
|
// repeated and returns this number (which can be 0)
|
||||||
// returns: the number
|
|
||||||
static unsigned DoLogNumberOfRepeats();
|
static unsigned DoLogNumberOfRepeats();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -294,6 +293,11 @@ private:
|
|||||||
|
|
||||||
static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour
|
static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour
|
||||||
static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace
|
static wxArrayString ms_aTraceMasks; // more powerful filter for wxLogTrace
|
||||||
|
|
||||||
|
|
||||||
|
// this is the replacement of DoLogNumberOfRepeats() (which has to be kept
|
||||||
|
// to avoid breaking ABI in this version)
|
||||||
|
unsigned LogLastRepetitionCountIfNeeded();
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -285,12 +285,17 @@ wxCRIT_SECT_DECLARE(gs_prevCS);
|
|||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
unsigned wxLog::DoLogNumberOfRepeats()
|
unsigned wxLog::DoLogNumberOfRepeats()
|
||||||
|
{
|
||||||
|
wxLog * const pLogger = GetActiveTarget();
|
||||||
|
return pLogger ? pLogger->LogLastRepetitionCountIfNeeded() : 0u;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned wxLog::LogLastRepetitionCountIfNeeded()
|
||||||
{
|
{
|
||||||
wxCRIT_SECT_LOCKER(lock, gs_prevCS);
|
wxCRIT_SECT_LOCKER(lock, gs_prevCS);
|
||||||
|
|
||||||
long retval = ms_prevCounter;
|
long retval = ms_prevCounter;
|
||||||
wxLog *pLogger = GetActiveTarget();
|
if ( ms_prevCounter > 0 )
|
||||||
if ( pLogger && ms_prevCounter > 0 )
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
#if wxUSE_INTL
|
#if wxUSE_INTL
|
||||||
@@ -303,14 +308,14 @@ unsigned wxLog::DoLogNumberOfRepeats()
|
|||||||
#endif
|
#endif
|
||||||
ms_prevCounter = 0;
|
ms_prevCounter = 0;
|
||||||
ms_prevString.clear();
|
ms_prevString.clear();
|
||||||
pLogger->DoLog(ms_prevLevel, msg.c_str(), ms_prevTimeStamp);
|
DoLog(ms_prevLevel, msg.c_str(), ms_prevTimeStamp);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLog::~wxLog()
|
wxLog::~wxLog()
|
||||||
{
|
{
|
||||||
wxLog::DoLogNumberOfRepeats();
|
LogLastRepetitionCountIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
@@ -334,7 +339,7 @@ void wxLog::OnLog(wxLogLevel level, const wxChar *szString, time_t t)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoLogNumberOfRepeats();
|
pLogger->LogLastRepetitionCountIfNeeded();
|
||||||
|
|
||||||
// reset repetition counter for a new message
|
// reset repetition counter for a new message
|
||||||
ms_prevString = szString;
|
ms_prevString = szString;
|
||||||
|
Reference in New Issue
Block a user