+ wxSTD ostream *m_ostr;
+};
+
+#endif // wxUSE_STD_IOSTREAM
+
+// ----------------------------------------------------------------------------
+// /dev/null log target: suppress logging until this object goes out of scope
+// ----------------------------------------------------------------------------
+
+// example of usage:
+/*
+ void Foo()
+ {
+ wxFile file;
+
+ // wxFile.Open() normally complains if file can't be opened, we don't
+ // want it
+ wxLogNull logNo;
+
+ if ( !file.Open("bar") )
+ ... process error ourselves ...
+
+ // ~wxLogNull called, old log sink restored
+ }
+ */
+class WXDLLEXPORT wxLogNull
+{
+public:
+ wxLogNull() { m_flagOld = wxLog::EnableLogging(FALSE); }
+ ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); }
+
+private:
+ bool m_flagOld; // the previous value of the wxLog::ms_doLog
+};
+
+// ----------------------------------------------------------------------------
+// chaining log target: installs itself as a log target and passes all
+// messages to the real log target given to it in the ctor but also forwards
+// them to the previously active one
+//
+// note that you don't have to call SetActiveTarget() with this class, it
+// does it itself in its ctor
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxLogChain : public wxLog
+{
+public:
+ wxLogChain(wxLog *logger);
+ virtual ~wxLogChain() { delete m_logOld; }
+
+ // change the new log target
+ void SetLog(wxLog *logger);
+
+ // this can be used to temporarily disable (and then reenable) passing
+ // messages to the old logger (by default we do pass them)
+ void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
+
+ // are we passing the messages to the previous log target?
+ bool IsPassingMessages() const { return m_bPassMessages; }
+
+ // return the previous log target (may be NULL)
+ wxLog *GetOldLog() const { return m_logOld; }
+
+ // override base class version to flush the old logger as well
+ virtual void Flush();
+
+protected:
+ // pass the chain to the old logger if needed
+ virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t);
+
+private:
+ // the current log target
+ wxLog *m_logNew;
+
+ // the previous log target
+ wxLog *m_logOld;
+
+ // do we pass the messages to the old logger?
+ bool m_bPassMessages;