Don't evaluate arguments passed to KI_TRACE if tracing is disabled.
This commit is contained in:
parent
eccbb374a0
commit
ebbfc25420
|
@ -292,17 +292,27 @@ TRACE_MANAGER& TRACE_MANAGER::Instance()
|
||||||
return *self;
|
return *self;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRACE_MANAGER::traceV( const wxString& aWhat, const wxString& aFmt, va_list vargs )
|
|
||||||
|
bool TRACE_MANAGER::IsTraceEnabled( const wxString& aWhat )
|
||||||
{
|
{
|
||||||
if( !m_printAllTraces )
|
if( !m_printAllTraces )
|
||||||
{
|
{
|
||||||
if( !m_globalTraceEnabled )
|
if( !m_globalTraceEnabled )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if( m_enabledTraces.find( aWhat ) == m_enabledTraces.end() )
|
if( m_enabledTraces.find( aWhat ) == m_enabledTraces.end() )
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TRACE_MANAGER::traceV( const wxString& aWhat, const wxString& aFmt, va_list vargs )
|
||||||
|
{
|
||||||
|
if( !IsTraceEnabled( aWhat ) )
|
||||||
|
return;
|
||||||
|
|
||||||
wxString str;
|
wxString str;
|
||||||
str.PrintfV( aFmt, vargs );
|
str.PrintfV( aFmt, vargs );
|
||||||
|
|
||||||
|
@ -311,6 +321,7 @@ void TRACE_MANAGER::traceV( const wxString& aWhat, const wxString& aFmt, va_list
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TRACE_MANAGER::init()
|
void TRACE_MANAGER::init()
|
||||||
{
|
{
|
||||||
wxString traceVars;
|
wxString traceVars;
|
||||||
|
|
|
@ -255,6 +255,8 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool IsTraceEnabled( const wxString& aWhat );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void traceV( const wxString& aWhat, const wxString& aFmt, va_list vargs );
|
void traceV( const wxString& aWhat, const wxString& aFmt, va_list vargs );
|
||||||
void init();
|
void init();
|
||||||
|
@ -264,6 +266,8 @@ private:
|
||||||
bool m_printAllTraces;
|
bool m_printAllTraces;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define KI_TRACE( ... ) TRACE_MANAGER::Instance().Trace( __VA_ARGS__ )
|
#define KI_TRACE( aWhat, ... ) \
|
||||||
|
if( TRACE_MANAGER::Instance().IsTraceEnabled( aWhat ) ) \
|
||||||
|
TRACE_MANAGER::Instance().Trace( aWhat, __VA_ARGS__ )
|
||||||
|
|
||||||
#endif // _TRACE_HELPERS_H_
|
#endif // _TRACE_HELPERS_H_
|
||||||
|
|
Loading…
Reference in New Issue