From: Adeel Kazmi Date: Thu, 20 Aug 2015 16:23:19 +0000 (+0100) Subject: (Logging) Ensure we do not output unrequired spaces & colons when trace is not enabled X-Git-Tag: dali_1.1.1~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F70%2F46470%2F1;p=platform%2Fcore%2Fuifw%2Fdali-core.git (Logging) Ensure we do not output unrequired spaces & colons when trace is not enabled Before: No Trace: INFO: DALI: : MyDebug Now: No Trace: INFO: DALI: MyDebug Before: Trace: INFO: DALI: Entr: MyFunction() INFO: DALI: : MyDebug INFO: DALI: Exit: MyFunction() Now: Trace: INFO: DALI: Entr: MyFunction() INFO: DALI: : MyDebug INFO: DALI: Exit: MyFunction() Change-Id: I3a04b50154a4f23ca90cad5a7ad2ef26ae6cb1cf --- diff --git a/dali/integration-api/debug.cpp b/dali/integration-api/debug.cpp index dd62a17..e67b165 100644 --- a/dali/integration-api/debug.cpp +++ b/dali/integration-api/debug.cpp @@ -198,13 +198,21 @@ void Filter::Log(LogLevel level, const char* format, ...) va_list arg; va_start(arg, format); - char *buffer = NULL; - int numChars = asprintf(&buffer, "%-*c %s", mNesting, ':', format); - if(numChars >= 0) // No error + if( mTraceEnabled ) { - std::string message = ArgListToString(buffer, arg); - LogMessage(DebugInfo, message.c_str()); - free(buffer); + char *buffer = NULL; + int numChars = asprintf( &buffer, " %-*c %s", mNesting, ':', format ); + if( numChars >= 0 ) // No error + { + std::string message = ArgListToString( buffer, arg ); + LogMessage( DebugInfo, message.c_str() ); + free( buffer ); + } + } + else + { + std::string message = ArgListToString( format, arg ); + LogMessage( DebugInfo, message.c_str() ); } va_end(arg); }