#include "wx/string.h"
#include "wx/strvararg.h"
+// ----------------------------------------------------------------------------
+// forward declarations
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_FWD_BASE wxObject;
+
+#if wxUSE_GUI
+ class WXDLLIMPEXP_FWD_CORE wxFrame;
+#endif // wxUSE_GUI
+
#if wxUSE_LOG
#include "wx/arrstr.h"
#endif
#endif
-// ----------------------------------------------------------------------------
-// forward declarations
-// ----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_FWD_BASE wxObject;
-
-#if wxUSE_GUI
- class WXDLLIMPEXP_FWD_CORE wxFrame;
-#endif // wxUSE_GUI
-
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// get string trace masks: note that this is MT-unsafe if other threads can
// call AddTraceMask() concurrently
- static const wxArrayString& GetTraceMasks() { return ms_aTraceMasks; }
+ static const wxArrayString& GetTraceMasks();
// sets the time stamp string format: this is used as strftime() format
// string for the log targets which add time stamps to the messages; set
#if WXWIN_COMPATIBILITY_2_6
// this function doesn't do anything any more, don't call it
- wxDEPRECATED_INLINE(
- static wxChar *SetLogBuffer(wxChar *, size_t = 0), return NULL;
+ static wxDEPRECATED_INLINE(
+ wxChar *SetLogBuffer(wxChar *, size_t = 0), return NULL;
);
#endif // WXWIN_COMPATIBILITY_2_6
// don't use integer masks any more, use string trace masks instead
#if WXWIN_COMPATIBILITY_2_8
- wxDEPRECATED_INLINE( static void SetTraceMask(wxTraceMask ulMask),
+ static wxDEPRECATED_INLINE( void SetTraceMask(wxTraceMask ulMask),
ms_ulTraceMask = ulMask; )
// this one can't be marked deprecated as it's used in our own wxLogger
#if WXWIN_COMPATIBILITY_2_8
static wxTraceMask ms_ulTraceMask; // controls wxLogTrace behaviour
#endif // WXWIN_COMPATIBILITY_2_8
-
- // currently enabled trace masks
- static wxArrayString ms_aTraceMasks;
};
// ----------------------------------------------------------------------------
wxDO_LOG(level)
// wxLogFatalError() is special as it can't be disabled
-#define wxLogFatalError wxDO_LOG(FatalError)
+#define wxLogFatalError wxDO_LOG(FatalError)
#define wxVLogFatalError(format, argptr) wxDO_LOGV(FatalError, format, argptr)
#define wxLogError wxDO_LOG_IF_ENABLED(Error)
// WX_WATCOM_ONLY_CODE is needed to work around
// http://bugzilla.openwatcom.org/show_bug.cgi?id=351
#define wxDEFINE_EMPTY_LOG_FUNCTION(level) \
- WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxString&)) \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxFormatString&)) \
WX_WATCOM_ONLY_CODE( \
WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const char*)) \
WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wchar_t*)) \
WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxCStrData&)) \
) \
- inline void wxVLog##level(const wxString& WXUNUSED(format), \
+ inline void wxVLog##level(const wxFormatString& WXUNUSED(format), \
va_list WXUNUSED(argptr)) { } \
#define wxDEFINE_EMPTY_LOG_FUNCTION2(level, argclass) \
- WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxString&)) \
+ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxFormatString&)) \
WX_WATCOM_OR_MINGW_ONLY_CODE( \
WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const char*)) \
WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wchar_t*)) \
WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxCStrData&)) \
) \
inline void wxVLog##level(argclass WXUNUSED(arg), \
- const wxString& WXUNUSED(format), \
+ const wxFormatString& WXUNUSED(format), \
va_list WXUNUSED(argptr)) {}
wxDEFINE_EMPTY_LOG_FUNCTION(FatalError);
#ifdef HAVE_VARIADIC_MACROS
#define wxLogDebug(fmt, ...) wxLogNop()
#else // !HAVE_VARIADIC_MACROS
- WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxString&))
+ WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxFormatString&))
#endif
#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG
#define wxLogTrace(mask, fmt, ...) wxLogNop()
#else // !HAVE_VARIADIC_MACROS
#if WXWIN_COMPATIBILITY_2_8
- WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxString&))
+ WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxFormatString&))
#endif
- WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxString&))
+ WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxFormatString&))
#ifdef __WATCOMC__
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const char*, const char*))
#undef WX_WATCOM_ONLY_CODE
#endif
+// macro which disables debug logging in release builds: this is done by
+// default by wxIMPLEMENT_APP() so usually it doesn't need to be used explicitly
+#if defined(NDEBUG) && wxUSE_LOG_DEBUG
+ #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() \
+ wxLog::SetLogLevel(wxLOG_Info)
+#else // !NDEBUG
+ #define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()
+#endif // NDEBUG/!NDEBUG
+
#endif // _WX_LOG_H_