X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/67393addd823ea1a9b653a93c8554e7fd013ecfa..5f4d18209157a5ce671f101ec25734ac075a79f9:/include/wx/log.h?ds=sidebyside diff --git a/include/wx/log.h b/include/wx/log.h index 4561205cbe..b280d7d309 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -81,7 +81,7 @@ typedef unsigned long wxLogLevel; // ---------------------------------------------------------------------------- // different standard log levels (you may also define your own) -enum +enum wxLogLevelValues { wxLOG_FatalError, // program can't continue, abort immediately wxLOG_Error, // a serious error, user must be informed about it @@ -476,14 +476,14 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); WX_DEFINE_VARARG_FUNC_VOID(wxLog##level, wxDoLog##level) #define DECLARE_LOG_FUNCTION_IMPL(level) \ - extern void WXDLLIMPEXP_BASE wxVLog##level(const wxChar *szFormat, \ + extern void WXDLLIMPEXP_BASE wxVLog##level(const wxString& format, \ va_list argptr); \ - extern void WXDLLIMPEXP_BASE wxDoLog##level(const wxChar *szFormat, \ - ...) ATTRIBUTE_PRINTF_1 + extern void WXDLLIMPEXP_BASE \ + wxDoLog##level(const wxChar *szFormat, ...) ATTRIBUTE_PRINTF_1 #define DECLARE_LOG_FUNCTION2_EXP_IMPL(level, argclass, arg, expdecl) \ extern void expdecl wxVLog##level(argclass arg, \ - const wxChar *szFormat, \ + const wxString& format, \ va_list argptr); \ extern void expdecl wxDoLog##level(argclass arg, \ const wxChar *szFormat, \ @@ -497,12 +497,12 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); WX_DEFINE_VARARG_FUNC_NOP(wxLog##level) #define DECLARE_LOG_FUNCTION_IMPL(level) \ - inline void wxVLog##level(const wxChar *WXUNUSED(szFormat), \ + inline void wxVLog##level(const wxString& WXUNUSED(format), \ va_list WXUNUSED(argptr)) { } \ #define DECLARE_LOG_FUNCTION2_EXP_IMPL(level, argclass, arg, expdecl) \ inline void wxVLog##level(argclass WXUNUSED(arg), \ - const wxChar *WXUNUSED(szFormat), \ + const wxString& WXUNUSED(format), \ va_list WXUNUSED(argptr)) {} // Empty Class to fake wxLogNull @@ -539,6 +539,12 @@ public: #define DECLARE_LOG_FUNCTION2(level, argclass, arg) \ DECLARE_LOG_FUNCTION2_EXP(level, argclass, arg, WXDLLIMPEXP_BASE) +// VC6 produces a warning if we a macro expanding to nothing to +// DECLARE_LOG_FUNCTION2_IMPL: +#if defined(__VISUALC__) && __VISUALC__ < 1300 + // "not enough actual parameters for macro 'DECLARE_LOG_FUNCTION2_EXP_IMPL'" + #pragma warning(disable:4003) +#endif // a generic function for all levels (level is passes as parameter) DECLARE_LOG_FUNCTION2(Generic, wxLogLevel, level); @@ -562,7 +568,7 @@ DECLARE_LOG_FUNCTION_IMPL(Status); DECLARE_LOG_FUNCTION2_EXP_IMPL(Status, wxFrame *, pFrame, WXDLLIMPEXP_CORE); #endif // wxUSE_GUI -DECLARE_LOG_FUNCTION_PUBLIC(Status); +DECLARE_LOG_FUNCTION_PUBLIC(Status) // additional one: as wxLogError, but also logs last system call error code // and the corresponding error message if available @@ -572,7 +578,7 @@ DECLARE_LOG_FUNCTION_IMPL(SysError); // that don't set the errno (like registry APIs in Win32)) DECLARE_LOG_FUNCTION2_IMPL(SysError, long, lErrCode); -DECLARE_LOG_FUNCTION_PUBLIC(SysError); +DECLARE_LOG_FUNCTION_PUBLIC(SysError) // debug functions do nothing in release mode #if wxUSE_LOG && wxUSE_LOG_DEBUG @@ -584,12 +590,12 @@ DECLARE_LOG_FUNCTION_PUBLIC(SysError); // this version only logs the message if the mask had been added to the // list of masks with AddTraceMask() - DECLARE_LOG_FUNCTION2_IMPL(Trace, const wxChar*, mask); + DECLARE_LOG_FUNCTION2_IMPL(Trace, const wxString&, mask); // and this one does nothing if all of level bits are not set in // wxLog::GetActive()->GetTraceMask() -- it's deprecated in favour of // string identifiers DECLARE_LOG_FUNCTION2_IMPL(Trace, wxTraceMask, mask); - DECLARE_LOG_FUNCTION_PUBLIC(Trace); + DECLARE_LOG_FUNCTION_PUBLIC(Trace) #else //!debug || !wxUSE_LOG // these functions do nothing in release builds, but don't define them as // nothing as it could result in different code structure in debug and @@ -620,6 +626,10 @@ DECLARE_LOG_FUNCTION_PUBLIC(SysError); #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS #endif // debug/!debug +#if defined(__VISUALC__) && __VISUALC__ < 1300 + #pragma warning(default:4003) +#endif + // wxLogFatalError helper: show the (fatal) error to the user in a safe way, // i.e. without using wxMessageBox() for example because it could crash void WXDLLIMPEXP_BASE