optionally count repeating wxLog messages instead of logging all (patch 1520815)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -139,15 +139,7 @@ public:
|
||||
|
||||
// static sink function - see DoLog() for function to overload in the
|
||||
// derived classes
|
||||
static void OnLog(wxLogLevel level, const wxChar *szString, time_t t)
|
||||
{
|
||||
if ( IsEnabled() && ms_logLevel >= level )
|
||||
{
|
||||
wxLog *pLogger = GetActiveTarget();
|
||||
if ( pLogger )
|
||||
pLogger->DoLog(level, szString, t);
|
||||
}
|
||||
}
|
||||
static void OnLog(wxLogLevel level, const wxChar *szString, time_t t);
|
||||
|
||||
// message buffering
|
||||
|
||||
@@ -195,6 +187,14 @@ public:
|
||||
// current is NULL?
|
||||
static void DontCreateOnDemand();
|
||||
|
||||
// log the count of repeating messages instead of logging the messages
|
||||
// multiple times
|
||||
static void SetRepetitionCounting(bool bRepetCounting = true)
|
||||
{ ms_bRepetCounting = bRepetCounting; }
|
||||
|
||||
// gets duplicate counting status
|
||||
static bool GetRepetitionCounting() { return ms_bRepetCounting; }
|
||||
|
||||
// trace mask (see wxTraceXXX constants for details)
|
||||
static void SetTraceMask(wxTraceMask ulMask) { ms_ulTraceMask = ulMask; }
|
||||
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
static void TimeStamp(wxString *str);
|
||||
|
||||
// make dtor virtual for all derived classes
|
||||
virtual ~wxLog() { }
|
||||
virtual ~wxLog();
|
||||
|
||||
|
||||
// this method exists for backwards compatibility only, don't use
|
||||
@@ -259,10 +259,23 @@ protected:
|
||||
// you override DoLog() you might not need it at all
|
||||
virtual void DoLogString(const wxChar *szString, time_t t);
|
||||
|
||||
// log a line containing the number of times the previous message was
|
||||
// repeated
|
||||
// returns: the number
|
||||
static unsigned DoLogNumberOfRepeats();
|
||||
|
||||
private:
|
||||
// static variables
|
||||
// ----------------
|
||||
|
||||
// traditional behaviour or counting repetitions
|
||||
static bool ms_bRepetCounting;
|
||||
static wxString ms_prevString; // previous message that was logged
|
||||
// how many times the previous message was logged
|
||||
static unsigned ms_prevCounter;
|
||||
static time_t ms_prevTimeStamp;// timestamp of the previous message
|
||||
static wxLogLevel ms_prevLevel; // level of the previous message
|
||||
|
||||
static wxLog *ms_pLogger; // currently active log sink
|
||||
static bool ms_doLog; // false => all logging disabled
|
||||
static bool ms_bAutoCreate; // create new log targets on demand?
|
||||
|
Reference in New Issue
Block a user