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;
|
||||
}
|
||||
|
||||
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_globalTraceEnabled )
|
||||
return;
|
||||
return false;
|
||||
|
||||
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;
|
||||
str.PrintfV( aFmt, vargs );
|
||||
|
||||
|
@ -311,6 +321,7 @@ void TRACE_MANAGER::traceV( const wxString& aWhat, const wxString& aFmt, va_list
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TRACE_MANAGER::init()
|
||||
{
|
||||
wxString traceVars;
|
||||
|
|
|
@ -255,6 +255,8 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
bool IsTraceEnabled( const wxString& aWhat );
|
||||
|
||||
private:
|
||||
void traceV( const wxString& aWhat, const wxString& aFmt, va_list vargs );
|
||||
void init();
|
||||
|
@ -264,6 +266,8 @@ private:
|
|||
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_
|
||||
|
|
Loading…
Reference in New Issue