X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e4db172a3b318df9aff178eb6c5da149d56e0859..77a1771911ed222ba6861ead327c3735fc16a0b1:/src/common/log.cpp?ds=inline diff --git a/src/common/log.cpp b/src/common/log.cpp index d7a7e7e895..c17db339d9 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -33,6 +33,7 @@ #include "wx/arrstr.h" #include "wx/intl.h" #include "wx/string.h" + #include "wx/utils.h" #endif //WX_PRECOMP #include "wx/apptrait.h" @@ -40,7 +41,6 @@ #include "wx/msgout.h" #include "wx/textfile.h" #include "wx/thread.h" -#include "wx/utils.h" #include "wx/wxchar.h" // other standard headers @@ -96,12 +96,6 @@ static wxCriticalSection gs_csLogBuf; #endif // wxUSE_THREADS -// return true if we have a non NULL non disabled log target -static inline bool IsLoggingEnabled() -{ - return wxLog::IsEnabled() && (wxLog::GetActiveTarget() != NULL); -} - // ---------------------------------------------------------------------------- // implementation of Log functions // @@ -110,7 +104,7 @@ static inline bool IsLoggingEnabled() // ---------------------------------------------------------------------------- // wrapper for wxVsnprintf(s_szBuf) which always NULL-terminates it -static inline void PrintfInLogBug(const wxChar *szFormat, va_list argptr) +static inline void PrintfInLogBuf(const wxChar *szFormat, va_list argptr) { if ( wxVsnprintf(s_szBuf, s_szBufSize, szFormat, argptr) < 0 ) { @@ -123,10 +117,10 @@ static inline void PrintfInLogBug(const wxChar *szFormat, va_list argptr) // generic log function void wxVLogGeneric(wxLogLevel level, const wxChar *szFormat, va_list argptr) { - if ( IsLoggingEnabled() ) { + if ( wxLog::IsEnabled() ) { wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); - PrintfInLogBug(szFormat, argptr); + PrintfInLogBuf(szFormat, argptr); wxLog::OnLog(level, s_szBuf, time(NULL)); } @@ -143,10 +137,10 @@ void wxLogGeneric(wxLogLevel level, const wxChar *szFormat, ...) #define IMPLEMENT_LOG_FUNCTION(level) \ void wxVLog##level(const wxChar *szFormat, va_list argptr) \ { \ - if ( IsLoggingEnabled() ) { \ + if ( wxLog::IsEnabled() ) { \ wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); \ \ - PrintfInLogBug(szFormat, argptr); \ + PrintfInLogBuf(szFormat, argptr); \ \ wxLog::OnLog(wxLOG_##level, s_szBuf, time(NULL)); \ } \ @@ -204,7 +198,7 @@ void wxLogFatalError(const wxChar *szFormat, ...) // same as info, but only if 'verbose' mode is on void wxVLogVerbose(const wxChar *szFormat, va_list argptr) { - if ( IsLoggingEnabled() ) { + if ( wxLog::IsEnabled() ) { if ( wxLog::GetActiveTarget() != NULL && wxLog::GetVerbose() ) { wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); @@ -228,7 +222,7 @@ void wxLogVerbose(const wxChar *szFormat, ...) #define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \ void wxVLog##level(const wxChar *szFormat, va_list argptr) \ { \ - if ( IsLoggingEnabled() ) { \ + if ( wxLog::IsEnabled() ) { \ wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); \ \ wxVsnprintf(s_szBuf, s_szBufSize, szFormat, argptr); \ @@ -246,7 +240,7 @@ void wxLogVerbose(const wxChar *szFormat, ...) void wxVLogTrace(const wxChar *mask, const wxChar *szFormat, va_list argptr) { - if ( IsLoggingEnabled() && wxLog::IsAllowedTraceMask(mask) ) { + if ( wxLog::IsEnabled() && wxLog::IsAllowedTraceMask(mask) ) { wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); wxChar *p = s_szBuf; @@ -282,7 +276,7 @@ void wxLogVerbose(const wxChar *szFormat, ...) // 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 ( IsLoggingEnabled() && ((wxLog::GetTraceMask() & mask) == mask) ) { + if ( wxLog::IsEnabled() && ((wxLog::GetTraceMask() & mask) == mask) ) { wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); wxVsnprintf(s_szBuf, s_szBufSize, szFormat, argptr); @@ -322,7 +316,7 @@ void wxLogSysErrorHelper(long lErrCode) void WXDLLEXPORT wxVLogSysError(const wxChar *szFormat, va_list argptr) { - if ( IsLoggingEnabled() ) { + if ( wxLog::IsEnabled() ) { wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); wxVsnprintf(s_szBuf, s_szBufSize, szFormat, argptr); @@ -341,7 +335,7 @@ void WXDLLEXPORT wxLogSysError(const wxChar *szFormat, ...) void WXDLLEXPORT wxVLogSysError(long lErrCode, const wxChar *szFormat, va_list argptr) { - if ( IsLoggingEnabled() ) { + if ( wxLog::IsEnabled() ) { wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); wxVsnprintf(s_szBuf, s_szBufSize, szFormat, argptr);