-IMPLEMENT_LOG_FUNCTION(Debug)
-IMPLEMENT_LOG_FUNCTION(Trace)
-
-void wxLogVerbose(wxTString strFormat, ...)
-{
- if ( wxLog::GetVerbose() && wxLog::GetActiveTarget() != NULL ) {
- va_list argptr;
- va_start(argptr, strFormat);
- vsprintf(s_szBuf, strFormat, argptr);
- va_end(argptr);
-
- wxLog::OnLog(wxLog::Info, s_szBuf);
- }
+ 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));
+ }
+ }
+
+#else // release
+ #define IMPLEMENT_LOG_DEBUG_FUNCTION(level)
+#endif
+
+IMPLEMENT_LOG_DEBUG_FUNCTION(Debug)
+IMPLEMENT_LOG_DEBUG_FUNCTION(Trace)
+
+// wxLogSysError: one uses the last error code, for other you must give it
+// explicitly
+
+// common part of both wxLogSysError
+void wxLogSysErrorHelper(long lErrCode)
+{
+ wxChar szErrMsg[LOG_BUFFER_SIZE / 2];
+ wxSnprintf(szErrMsg, WXSIZEOF(szErrMsg),
+ _(" (error %ld: %s)"), lErrCode, wxSysErrorMsg(lErrCode));
+ wxStrncat(s_szBuf, szErrMsg, WXSIZEOF(s_szBuf) - wxStrlen(s_szBuf));
+
+ wxLog::OnLog(wxLOG_Error, s_szBuf, time(NULL));