// 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
// 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; }
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
// 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?
// "trivial" derivations of wxLog
// ----------------------------------------------------------------------------
-#if wxABI_VERSION > 20601
-
// log everything to a buffer
class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog
{
DECLARE_NO_COPY_CLASS(wxLogBuffer)
};
-#endif // wxABI_VERSION
// log everything to a "FILE *", stderr by default
class WXDLLIMPEXP_BASE wxLogStderr : public wxLog