- // ctor
- wxLog();
-
- // sink function
- static void OnLog(wxLogLevel level, const char *szString)
- { if ( ms_pLogger != 0 ) ms_pLogger->DoLog(level, szString); }
-
- // message buffering
- // flush shows all messages if they're not logged immediately
- // (FILE and iostream logs don't need it, but wxGuiLog does to avoid
- // showing 17 modal dialogs one after another)
- virtual void Flush();
- // call to Flush() may be optimized: call it only if this function
- // returns true (although Flush() also returns immediately if there
- // is no messages, this functions is more efficient because inline)
- bool HasPendingMessages() const { return m_bHasMessages; }
-
- // only one sink is active at each moment
- // get current log target, will call wxApp::CreateLogTarget() to create one
- // if
- static wxLog *GetActiveTarget();
- // change log target, pLogger = NULL disables logging,
- // returns the previous log target
- static wxLog *SetActiveTarget(wxLog *pLogger);
-
- // functions controlling the default wxLog behaviour
- // verbose mode is activated by standard command-line '-verbose' option
- void SetVerbose(bool bVerbose = TRUE) { m_bVerbose = bVerbose; }
- // sets the format for timestamp prepended by wxLog::DoLog(): it's
- // passed to strftime() function, see it's documentation for details.
- // no time stamp at all if szTF is NULL or empty
- // NB: the string is not copied, so it's lifetime must be long enough!
- void SetTimeStampFormat(const char *szTF) { m_szTimeFormat = szTF; }
+ // ctor
+ wxLog(){}
+
+ // Internal buffer.
+
+ // Allow replacement of the fixed size static buffer with
+ // a user allocated one. Pass in NULL to restore the
+ // built in static buffer.
+ static wxChar *SetLogBuffer( wxChar *buf, size_t size = 0 );
+
+ // these functions allow to completely disable all log messages
+
+ // is logging disabled now?
+ static bool IsEnabled() { return ms_doLog; }
+
+ // change the flag state, return the previous one
+ static bool EnableLogging(bool doIt = true)
+ { bool doLogOld = ms_doLog; ms_doLog = doIt; return doLogOld; }
+
+ // static sink function - see DoLog() for function to overload in the
+ // derived classes
+ static void OnLog(wxLogLevel level, const wxChar *szString, time_t t);
+
+ // message buffering
+
+ // flush shows all messages if they're not logged immediately (FILE
+ // and iostream logs don't need it, but wxGuiLog does to avoid showing
+ // 17 modal dialogs one after another)
+ virtual void Flush();
+
+ // flush the active target if any
+ static void FlushActive()
+ {
+ if ( !ms_suspendCount )
+ {
+ wxLog *log = GetActiveTarget();
+ if ( log )
+ log->Flush();
+ }
+ }
+
+ // only one sink is active at each moment
+ // get current log target, will call wxApp::CreateLogTarget() to
+ // create one if none exists
+ static wxLog *GetActiveTarget();
+
+ // change log target, pLogger may be NULL
+ static wxLog *SetActiveTarget(wxLog *pLogger);
+
+ // suspend the message flushing of the main target until the next call
+ // to Resume() - this is mainly for internal use (to prevent wxYield()
+ // from flashing the messages)
+ static void Suspend() { ms_suspendCount++; }
+
+ // must be called for each Suspend()!
+ static void Resume() { ms_suspendCount--; }
+
+ // functions controlling the default wxLog behaviour
+ // verbose mode is activated by standard command-line '-verbose'
+ // option
+ static void SetVerbose(bool bVerbose = true) { ms_bVerbose = bVerbose; }
+
+ // Set log level. Log messages with level > logLevel will not be logged.
+ static void SetLogLevel(wxLogLevel logLevel) { ms_logLevel = logLevel; }
+
+ // should GetActiveTarget() try to create a new log object if the
+ // 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; }
+