-#define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \
- void wxLog##level(const char *szFormat, ...) \
- { \
- if ( wxLog::GetActiveTarget() != NULL ) { \
- va_list argptr; \
- va_start(argptr, szFormat); \
- vsprintf(s_szBuf, szFormat, argptr); \
- va_end(argptr); \
- \
- wxLog::OnLog(wxLOG_##level, s_szBuf); \
- } \
+#define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \
+ void wxVLog##level(const wxChar *szFormat, va_list argptr) \
+ { \
+ if ( IsLoggingEnabled() ) { \
+ wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); \
+ \
+ wxVsnprintf(s_szBuf, s_szBufSize, szFormat, argptr); \
+ \
+ wxLog::OnLog(wxLOG_##level, s_szBuf, time(NULL)); \
+ } \
+ } \
+ void wxLog##level(const wxChar *szFormat, ...) \
+ { \
+ va_list argptr; \
+ va_start(argptr, szFormat); \
+ wxVLog##level(szFormat, argptr); \
+ va_end(argptr); \
+ }
+
+ void wxVLogTrace(const wxChar *mask, const wxChar *szFormat, va_list argptr)
+ {
+ if ( IsLoggingEnabled() && wxLog::IsAllowedTraceMask(mask) ) {
+ wxCRIT_SECT_LOCKER(locker, gs_csLogBuf);
+
+ wxChar *p = s_szBuf;
+ size_t len = s_szBufSize;
+ wxStrncpy(s_szBuf, _T("("), len);
+ len -= 1; // strlen("(")
+ p += 1;
+ wxStrncat(p, mask, len);
+ size_t lenMask = wxStrlen(mask);
+ len -= lenMask;
+ p += lenMask;
+
+ wxStrncat(p, _T(") "), len);
+ len -= 2;
+ p += 2;
+
+ wxVsnprintf(p, len, szFormat, argptr);
+
+ wxLog::OnLog(wxLOG_Trace, s_szBuf, time(NULL));
+ }