#ifndef _WX_LOG_H_
#define _WX_LOG_H_
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma interface "log.h"
-#endif
-
#include "wx/defs.h"
// ----------------------------------------------------------------------------
// "trivial" derivations of wxLog
// ----------------------------------------------------------------------------
+// log everything to a buffer
+class WXDLLIMPEXP_BASE wxLogBuffer : public wxLog
+{
+public:
+ wxLogBuffer() { }
+
+ // get the string contents with all messages logged
+ const wxString& GetBuffer() const { return m_str; }
+
+ // show the buffer contents to the user in the best possible way (this uses
+ // wxMessageOutputMessageBox) and clear it
+ virtual void Flush();
+
+protected:
+ virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t);
+ virtual void DoLogString(const wxChar *szString, time_t t);
+
+private:
+ wxString m_str;
+
+ DECLARE_NO_COPY_CLASS(wxLogBuffer)
+};
+
+
// log everything to a "FILE *", stderr by default
class WXDLLIMPEXP_BASE wxLogStderr : public wxLog
{
- DECLARE_NO_COPY_CLASS(wxLogStderr)
-
public:
// redirect log output to a FILE
wxLogStderr(FILE *fp = (FILE *) NULL);
virtual void DoLogString(const wxChar *szString, time_t t);
FILE *m_fp;
+
+ DECLARE_NO_COPY_CLASS(wxLogStderr)
};
#if wxUSE_STD_IOSTREAM
DECLARE_LOG_FUNCTION2(Trace, wxTraceMask, mask);
#else //!debug
// these functions do nothing in release builds
+
+ // note that leaving out "fmt" in the vararg functions provokes a warning
+ // from SGI CC: "the last argument of the varargs function is unnamed"
inline void wxVLogDebug(const wxChar *, va_list) { }
- inline void wxLogDebug(const wxChar *, ...) { }
+ inline void wxLogDebug(const wxChar *fmt, ...) { wxUnusedVar(fmt); }
inline void wxVLogTrace(wxTraceMask, const wxChar *, va_list) { }
- inline void wxLogTrace(wxTraceMask, const wxChar *, ...) { }
+ inline void wxLogTrace(wxTraceMask, const wxChar *fmt, ...) { wxUnusedVar(fmt); }
inline void wxVLogTrace(const wxChar *, const wxChar *, va_list) { }
- inline void wxLogTrace(const wxChar *, const wxChar *, ...) { }
+ inline void wxLogTrace(const wxChar *, const wxChar *fmt, ...) { wxUnusedVar(fmt); }
#endif // debug/!debug
// wxLogFatalError helper: show the (fatal) error to the user in a safe way,