LogV(format, argptr);
}
+ void LogVTrace(const wxString& mask, const wxString& format, va_list argptr)
+ {
+ if ( !wxLog::IsAllowedTraceMask(mask) )
+ return;
+
+ Store(wxLOG_KEY_TRACE_MASK, mask);
+
+ LogV(format, argptr);
+ }
+
// vararg functions used by wxLogXXX():
{} \
else \
wxMAKE_LOGGER(Trace).LogTrace
+ #define wxVLogTrace \
+ if ( !wxLog::IsLevelEnabled(wxLOG_Trace, wxLOG_COMPONENT) ) \
+ {} \
+ else \
+ wxMAKE_LOGGER(Trace).LogVTrace
#else // !wxUSE_LOG_TRACE
#define wxVLogTrace(mask, fmt, valist) wxLogNop()
#if wxDEBUG_LEVEL
+namespace
+{
+
+const char *TEST_MASK = "test";
+
+// this is a test vararg function (a real one, not a variadic-template-like as
+// wxVLogTrace(), so care should be taken with its arguments)
+void TraceTest(const char *format, ...)
+{
+ va_list argptr;
+ va_start(argptr, format);
+ wxVLogTrace(TEST_MASK, format, argptr);
+ va_end(argptr);
+}
+
+} // anonymous namespace
+
void LogTestCase::Trace()
{
- static const char *TEST_MASK = "test";
+ // we use wxLogTrace() or wxVLogTrace() from inside TraceTest()
+ // interchangeably here, it shouldn't make any difference
wxLogTrace(TEST_MASK, "Not shown");
CPPUNIT_ASSERT_EQUAL( "", m_log->GetLog(wxLOG_Trace) );
wxLog::AddTraceMask(TEST_MASK);
- wxLogTrace(TEST_MASK, "Shown");
+ TraceTest("Shown");
CPPUNIT_ASSERT_EQUAL( wxString::Format("(%s) Shown", TEST_MASK),
m_log->GetLog(wxLOG_Trace) );
wxLog::RemoveTraceMask(TEST_MASK);
m_log->Clear();
- wxLogTrace(TEST_MASK, "Not shown again");
+ TraceTest("Not shown again");
CPPUNIT_ASSERT_EQUAL( "", m_log->GetLog(wxLOG_Trace) );
}