X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/04662def27c4227f8372084167e3a37729c048b9..53e112a093bb479c8032fad7467690196c67c2c6:/include/wx/log.h?ds=sidebyside diff --git a/include/wx/log.h b/include/wx/log.h index edbddebb63..c07ee5825f 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -240,6 +240,8 @@ private: // log everything to a "FILE *", stderr by default class WXDLLEXPORT wxLogStderr : public wxLog { + DECLARE_NO_COPY_CLASS(wxLogStderr) + public: // redirect log output to a FILE wxLogStderr(FILE *fp = (FILE *) NULL); @@ -293,8 +295,8 @@ protected: class WXDLLEXPORT wxLogNull { public: - wxLogNull() { m_flagOld = wxLog::EnableLogging(FALSE); } - ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); } + wxLogNull() : m_flagOld(wxLog::EnableLogging(FALSE)) { } + ~wxLogNull() { (void)wxLog::EnableLogging(m_flagOld); } private: bool m_flagOld; // the previous value of the wxLog::ms_doLog @@ -313,7 +315,7 @@ class WXDLLEXPORT wxLogChain : public wxLog { public: wxLogChain(wxLog *logger); - virtual ~wxLogChain() { delete m_logOld; } + virtual ~wxLogChain(); // change the new log target void SetLog(wxLog *logger); @@ -474,11 +476,13 @@ private: // return the last system error code WXDLLEXPORT unsigned long wxSysErrorCode(); + // return the error message for given (or last if 0) error code WXDLLEXPORT const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); +// ---------------------------------------------------------------------------- // define wxLog -// ------------------- +// ---------------------------------------------------------------------------- #define DECLARE_LOG_FUNCTION(level) \ extern void WXDLLEXPORT wxVLog##level(const wxChar *szFormat, \ @@ -557,6 +561,10 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode); inline void wxLogTrace(const wxChar *, const wxChar *, ...) { } #endif // debug/!debug +// 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 WXDLLEXPORT wxSafeShowMessage(const wxString& title, const wxString& text); + // ---------------------------------------------------------------------------- // debug only logging functions: use them with API name and error code // ---------------------------------------------------------------------------- @@ -586,4 +594,3 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode); #endif // _WX_LOG_H_ -// vi:sts=4:sw=4:et