+ void LogV(void *ptr, const wxString& format, va_list argptr)
+ {
+ Store(m_optKey, wxPtrToUInt(ptr));
+
+ LogV(format, argptr);
+ }
+
+ void LogVTrace(const wxString& mask, const wxString& format, va_list argptr)
+ {
+ if ( !wxLog::IsAllowedTraceMask(mask) )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ LogV(format, argptr);
+ }
+
+
+ // vararg functions used by wxLogXXX():
+
+ // will log the message at the level specified in the ctor
+ //
+ // notice that this function supposes that the caller already checked that
+ // the level was enabled and does no checks itself
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ Log,
+ 1, (const wxFormatString&),
+ DoLog, DoLogUtf8
+ )
+
+ // same as Log() but with an extra numeric or pointer parameters: this is
+ // used to pass an optional value by storing it in m_info under the name
+ // passed to MaybeStore() and is required to support "overloaded" versions
+ // of wxLogStatus() and wxLogSysError()
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ Log,
+ 2, (long, const wxFormatString&),
+ DoLogWithNum, DoLogWithNumUtf8
+ )
+
+ // unfortunately we can't use "void *" here as we get overload ambiguities
+ // with Log(wxFormatString, ...) when the first argument is a "char *" or
+ // "wchar_t *" then -- so we only allow passing wxObject here, which is
+ // ugly but fine in practice as this overload is only used by wxLogStatus()
+ // whose first argument is a wxFrame
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ Log,
+ 2, (wxObject *, const wxFormatString&),
+ DoLogWithPtr, DoLogWithPtrUtf8
+ )
+
+ // log the message at the level specified as its first argument
+ //
+ // as the macros don't have access to the level argument in this case, this
+ // function does check that the level is enabled itself
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ LogAtLevel,
+ 2, (wxLogLevel, const wxFormatString&),
+ DoLogAtLevel, DoLogAtLevelUtf8
+ )
+
+ // special versions for wxLogTrace() which is passed either string or
+ // integer mask as first argument determining whether the message should be
+ // logged or not
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ LogTrace,
+ 2, (const wxString&, const wxFormatString&),
+ DoLogTrace, DoLogTraceUtf8
+ )
+
+#if WXWIN_COMPATIBILITY_2_8
+ WX_DEFINE_VARARG_FUNC_VOID
+ (
+ LogTrace,
+ 2, (wxTraceMask, const wxFormatString&),
+ DoLogTraceMask, DoLogTraceMaskUtf8
+ )
+#endif // WXWIN_COMPATIBILITY_2_8
+
+#ifdef __WATCOMC__
+ // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 1, (const wxString&),
+ (wxFormatString(f1)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 1, (const wxCStrData&),
+ (wxFormatString(f1)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 1, (const char*),
+ (wxFormatString(f1)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 1, (const wchar_t*),
+ (wxFormatString(f1)))
+
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (long, const wxString&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (long, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (long, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (long, const wchar_t *),
+ (f1, wxFormatString(f2)))
+
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (wxObject *, const wxString&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (wxObject *, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (wxObject *, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, Log,
+ 2, (wxObject *, const wchar_t *),
+ (f1, wxFormatString(f2)))
+
+ WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel,
+ 2, (wxLogLevel, const wxString&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel,
+ 2, (wxLogLevel, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel,
+ 2, (wxLogLevel, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel,
+ 2, (wxLogLevel, const wchar_t *),
+ (f1, wxFormatString(f2)))
+
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (const wxString&, const wxString&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (const wxString&, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (const wxString&, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (const wxString&, const wchar_t *),
+ (f1, wxFormatString(f2)))
+
+#if WXWIN_COMPATIBILITY_2_8
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (wxTraceMask, wxTraceMask),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (wxTraceMask, const wxCStrData&),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (wxTraceMask, const char *),
+ (f1, wxFormatString(f2)))
+ WX_VARARG_WATCOM_WORKAROUND(void, LogTrace,
+ 2, (wxTraceMask, const wchar_t *),
+ (f1, wxFormatString(f2)))
+#endif // WXWIN_COMPATIBILITY_2_8
+#endif // __WATCOMC__
+
+private:
+#if !wxUSE_UTF8_LOCALE_ONLY
+ void DoLog(const wxChar *format, ...)
+ {
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogWithNum(long num, const wxChar *format, ...)
+ {
+ Store(m_optKey, num);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogWithPtr(void *ptr, const wxChar *format, ...)
+ {
+ Store(m_optKey, wxPtrToUInt(ptr));
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogAtLevel(wxLogLevel level, const wxChar *format, ...)
+ {
+ if ( !wxLog::IsLevelEnabled(level, m_info.component) )
+ return;
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(level, format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogTrace(const wxString& mask, const wxChar *format, ...)
+ {
+ if ( !wxLog::IsAllowedTraceMask(mask) )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+#if WXWIN_COMPATIBILITY_2_8
+ void DoLogTraceMask(wxTraceMask mask, const wxChar *format, ...)
+ {
+ if ( (wxLog::GetTraceMask() & mask) != mask )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+#endif // WXWIN_COMPATIBILITY_2_8
+#endif // !wxUSE_UTF8_LOCALE_ONLY
+
+#if wxUSE_UNICODE_UTF8
+ void DoLogUtf8(const char *format, ...)
+ {
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogWithNumUtf8(long num, const char *format, ...)
+ {
+ Store(m_optKey, num);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogWithPtrUtf8(void *ptr, const char *format, ...)
+ {
+ Store(m_optKey, wxPtrToUInt(ptr));
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogAtLevelUtf8(wxLogLevel level, const char *format, ...)
+ {
+ if ( !wxLog::IsLevelEnabled(level, m_info.component) )
+ return;
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(level, format, argptr);
+ va_end(argptr);
+ }
+
+ void DoLogTraceUtf8(const wxString& mask, const char *format, ...)
+ {
+ if ( !wxLog::IsAllowedTraceMask(mask) )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+
+#if WXWIN_COMPATIBILITY_2_8
+ void DoLogTraceMaskUtf8(wxTraceMask mask, const char *format, ...)
+ {
+ if ( (wxLog::GetTraceMask() & mask) != mask )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ va_list argptr;
+ va_start(argptr, format);
+ DoCallOnLog(format, argptr);
+ va_end(argptr);
+ }
+#endif // WXWIN_COMPATIBILITY_2_8
+#endif // wxUSE_UNICODE_UTF8
+
+ void DoCallOnLog(wxLogLevel level, const wxString& format, va_list argptr)
+ {
+ wxLog::OnLog(level, wxString::FormatV(format, argptr), m_info);
+ }
+
+ void DoCallOnLog(const wxString& format, va_list argptr)
+ {
+ DoCallOnLog(m_level, format, argptr);
+ }
+
+
+ const wxLogLevel m_level;
+ wxLogRecordInfo m_info;
+
+ wxString m_optKey;
+
+ wxDECLARE_NO_COPY_CLASS(wxLogger);
+};
+
+// ============================================================================
+// global functions
+// ============================================================================