-// debug functions don't use wxTString
-#undef IMPLEMENT_LOG_FUNCTION
-#define IMPLEMENT_LOG_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); \
- } \
+// same as info, but only if 'verbose' mode is on
+void wxLogVerbose(const wxChar *szFormat, ...)
+{
+ if ( IsLoggingEnabled() ) {
+ wxLog *pLog = wxLog::GetActiveTarget();
+ if ( pLog != NULL && pLog->GetVerbose() ) {
+ wxCRIT_SECT_LOCKER(locker, gs_csLogBuf);
+
+ va_list argptr;
+ va_start(argptr, szFormat);
+ wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr);
+ va_end(argptr);
+
+ wxLog::OnLog(wxLOG_Info, s_szBuf, time(NULL));
+ }
+ }
+}
+
+// debug functions
+#ifdef __WXDEBUG__
+#define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \
+ void wxLog##level(const wxChar *szFormat, ...) \
+ { \
+ if ( IsLoggingEnabled() ) { \
+ wxCRIT_SECT_LOCKER(locker, gs_csLogBuf); \
+ \
+ va_list argptr; \
+ va_start(argptr, szFormat); \
+ wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr); \
+ va_end(argptr); \
+ \
+ wxLog::OnLog(wxLOG_##level, s_szBuf, time(NULL)); \
+ } \
+ }
+
+ void wxLogTrace(const wxChar *mask, const wxChar *szFormat, ...)
+ {
+ if ( IsLoggingEnabled() && wxLog::IsAllowedTraceMask(mask) ) {
+ wxCRIT_SECT_LOCKER(locker, gs_csLogBuf);
+
+ wxChar *p = s_szBuf;
+ size_t len = WXSIZEOF(s_szBuf);
+ 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;
+
+ va_list argptr;
+ va_start(argptr, szFormat);
+ wxVsnprintf(p, len, szFormat, argptr);
+ va_end(argptr);
+
+ wxLog::OnLog(wxLOG_Trace, s_szBuf, time(NULL));
+ }
+ }
+
+ void wxLogTrace(wxTraceMask mask, 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) ) {
+ wxCRIT_SECT_LOCKER(locker, gs_csLogBuf);
+
+ va_list argptr;
+ va_start(argptr, szFormat);
+ wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr);
+ va_end(argptr);
+
+ wxLog::OnLog(wxLOG_Trace, s_szBuf, time(NULL));
+ }