-// fatal errors can't be suppressed nor handled by the custom log target and
-// always terminate the program
-void wxVLogFatalError(const wxString& format, va_list argptr)
-{
- wxSafeShowMessage(wxS("Fatal Error"), wxString::FormatV(format, argptr));
-
-#ifdef __WXWINCE__
- ExitThread(3);
-#else
- abort();
-#endif
-}
-
-#if !wxUSE_UTF8_LOCALE_ONLY
-void wxDoLogFatalErrorWchar(const wxChar *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogFatalError(format, argptr);
-
- // some compilers warn about unreachable code and it shouldn't matter
- // for the others anyhow...
- //va_end(argptr);
-}
-#endif // wxUSE_UTF8_LOCALE_ONLY
-
-#if wxUSE_UNICODE_UTF8
-void wxDoLogFatalErrorUtf8(const char *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogFatalError(format, argptr);
-
- // some compilers warn about unreachable code and it shouldn't matter
- // for the others anyhow...
- //va_end(argptr);
-}
-#endif // wxUSE_UNICODE_UTF8
-
-// same as info, but only if 'verbose' mode is on
-void wxVLogVerbose(const wxString& format, va_list argptr)
-{
- if ( wxLog::IsEnabled() ) {
- if ( wxLog::GetActiveTarget() != NULL && wxLog::GetVerbose() )
- wxLog::OnLog(wxLOG_Info, wxString::FormatV(format, argptr));
- }
-}
-
-#if !wxUSE_UTF8_LOCALE_ONLY
-void wxDoLogVerboseWchar(const wxChar *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogVerbose(format, argptr);
- va_end(argptr);
-}
-#endif // !wxUSE_UTF8_LOCALE_ONLY
-
-#if wxUSE_UNICODE_UTF8
-void wxDoLogVerboseUtf8(const char *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogVerbose(format, argptr);
- va_end(argptr);
-}
-#endif // wxUSE_UNICODE_UTF8
-
-// ----------------------------------------------------------------------------
-// debug and trace functions
-// ----------------------------------------------------------------------------
-
-#if wxUSE_LOG_DEBUG
- void wxVLogDebug(const wxString& format, va_list argptr)
- {
- if ( wxLog::IsEnabled() )
- {
- wxLog::OnLog(wxLOG_Debug, wxString::FormatV(format, argptr));
- }
- }
-
-#if !wxUSE_UTF8_LOCALE_ONLY
- void wxDoLogDebugWchar(const wxChar *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogDebug(format, argptr);
- va_end(argptr);
- }
-#endif // !wxUSE_UTF8_LOCALE_ONLY
-
-#if wxUSE_UNICODE_UTF8
- void wxDoLogDebugUtf8(const char *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogDebug(format, argptr);
- va_end(argptr);
- }
-#endif // wxUSE_UNICODE_UTF8
-#endif // wxUSE_LOG_DEBUG
-
-#if wxUSE_LOG_TRACE
- void wxVLogTrace(const wxString& mask, const wxString& format, va_list argptr)
- {
- if ( wxLog::IsEnabled() && wxLog::IsAllowedTraceMask(mask) ) {
- wxString msg;
- msg << wxS("(") << mask << wxS(") ") << wxString::FormatV(format, argptr);
-
- wxLog::OnLog(wxLOG_Trace, msg);
- }
- }
-
-#if !wxUSE_UTF8_LOCALE_ONLY
- void wxDoLogTraceWchar(const wxString& mask, const wxChar *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogTrace(mask, format, argptr);
- va_end(argptr);
- }
-#endif // !wxUSE_UTF8_LOCALE_ONLY
-
-#if wxUSE_UNICODE_UTF8
- void wxDoLogTraceUtf8(const wxString& mask, const char *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogTrace(mask, format, argptr);
- va_end(argptr);
- }
-#endif // wxUSE_UNICODE_UTF8
-
-// deprecated (but not declared as such because we don't want to complicate
-// DECLARE_LOG_FUNCTION macros even more) overloads for wxTraceMask
-#if WXWIN_COMPATIBILITY_2_8
- void wxVLogTrace(wxTraceMask mask, const wxString& format, va_list argptr)
- {
- // we check that all of mask bits are set in the current mask, so
- // that wxLogTrace(wxTraceRefCount | wxTraceOle) will only do something
- // if both bits are set.
- if ( wxLog::IsEnabled() && ((wxLog::GetTraceMask() & mask) == mask) ) {
- wxLog::OnLog(wxLOG_Trace, wxString::FormatV(format, argptr));
- }
- }
-
-#if !wxUSE_UTF8_LOCALE_ONLY
- void wxDoLogTraceWchar(wxTraceMask mask, const wxChar *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogTrace(mask, format, argptr);
- va_end(argptr);
- }
-#endif // !wxUSE_UTF8_LOCALE_ONLY
-
-#if wxUSE_UNICODE_UTF8
- void wxDoLogTraceUtf8(wxTraceMask mask, const char *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogTrace(mask, format, argptr);
- va_end(argptr);
- }
-#endif // wxUSE_UNICODE_UTF8
-
-#endif // WXWIN_COMPATIBILITY_2_8
-
-#ifdef __WATCOMC__
-#if WXWIN_COMPATIBILITY_2_8
- // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
- void wxDoLogTraceWchar(int mask, const wxChar *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogTrace(mask, format, argptr);
- va_end(argptr);
- }
-#endif // WXWIN_COMPATIBILITY_2_8
-
- void wxDoLogTraceWchar(const char *mask, const wxChar *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogTrace(mask, format, argptr);
- va_end(argptr);
- }
-
- void wxDoLogTraceWchar(const wchar_t *mask, const wxChar *format, ...)
- {
- va_list argptr;
- va_start(argptr, format);
- wxVLogTrace(mask, format, argptr);
- va_end(argptr);
- }
-
-#if WXWIN_COMPATIBILITY_2_8
- void wxVLogTrace(int mask, const wxString& format, va_list argptr)
- { wxVLogTrace((wxTraceMask)mask, format, argptr); }
-#endif // WXWIN_COMPATIBILITY_2_8
- void wxVLogTrace(const char *mask, const wxString& format, va_list argptr)
- { wxVLogTrace(wxString(mask), format, argptr); }
- void wxVLogTrace(const wchar_t *mask, const wxString& format, va_list argptr)
- { wxVLogTrace(wxString(mask), format, argptr); }
-#endif // __WATCOMC__
-#endif // wxUSE_LOG_TRACE
-
-
-// wxLogSysError: one uses the last error code, for other you must give it
-// explicitly
-
-// return the system error message description
-static inline wxString wxLogSysErrorHelper(long err)
-{
- return wxString::Format(_(" (error %ld: %s)"), err, wxSysErrorMsg(err));
-}
-
-void WXDLLIMPEXP_BASE wxVLogSysError(const wxString& format, va_list argptr)
-{
- wxVLogSysError(wxSysErrorCode(), format, argptr);
-}
-
-#if !wxUSE_UTF8_LOCALE_ONLY
-void WXDLLIMPEXP_BASE wxDoLogSysErrorWchar(const wxChar *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogSysError(format, argptr);
- va_end(argptr);
-}
-#endif // !wxUSE_UTF8_LOCALE_ONLY
-
-#if wxUSE_UNICODE_UTF8
-void WXDLLIMPEXP_BASE wxDoLogSysErrorUtf8(const char *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogSysError(format, argptr);
- va_end(argptr);
-}
-#endif // wxUSE_UNICODE_UTF8
-
-void WXDLLIMPEXP_BASE wxVLogSysError(long err, const wxString& format, va_list argptr)
-{
- if ( wxLog::IsEnabled() )
- {
- wxLog::OnLog(wxLOG_Error,
- wxString::FormatV(format, argptr) + wxLogSysErrorHelper(err));
- }
-}
-
-#if !wxUSE_UTF8_LOCALE_ONLY
-void WXDLLIMPEXP_BASE wxDoLogSysErrorWchar(long lErrCode, const wxChar *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogSysError(lErrCode, format, argptr);
- va_end(argptr);
-}
-#endif // !wxUSE_UTF8_LOCALE_ONLY
-
-#if wxUSE_UNICODE_UTF8
-void WXDLLIMPEXP_BASE wxDoLogSysErrorUtf8(long lErrCode, const char *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogSysError(lErrCode, format, argptr);
- va_end(argptr);
-}
-#endif // wxUSE_UNICODE_UTF8
-
-#ifdef __WATCOMC__
-// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
-void WXDLLIMPEXP_BASE wxDoLogSysErrorWchar(unsigned long lErrCode, const wxChar *format, ...)
-{
- va_list argptr;
- va_start(argptr, format);
- wxVLogSysError(lErrCode, format, argptr);
- va_end(argptr);
-}
-
-void WXDLLIMPEXP_BASE wxVLogSysError(unsigned long err, const wxString& format, va_list argptr)
- { wxVLogSysError((long)err, format, argptr); }
-#endif // __WATCOMC__
-