Merge changes from topic "imsmedia-log-optimization" into main * changes: Implementation for logging level configuration in ImsMediaService Add unit test cases for Log class disable identified debug logs in production builds in ImsMediaService Add customized Logging support in Imsmedia
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp index 524132c..ff0f8c6 100644 --- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp +++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/utils/ImsMediaTrace.cpp
@@ -15,9 +15,9 @@ */ #include <ImsMediaTrace.h> +#include <log/log_properties.h> #include <string.h> #include <utils/Log.h> -#include <sys/time.h> #ifdef IM_FILE_LOG #include <stdio.h> @@ -66,12 +66,14 @@ } while (0) #endif +#define IM_IS_DEBUGGABLE() (gLogMode <= kLogEnableDebug && __android_log_is_debuggable()) + static uint gLogMode = kLogEnableDebug; static uint gDebugLogMode = 0; void ImsMediaTrace::IMLOGD_PACKET_ARG(IM_PACKET_LOG_TYPE type, const char* format, ...) { - if (gDebugLogMode & type && gLogMode <= kLogEnableDebug) + if (gDebugLogMode & type && IM_IS_DEBUGGABLE()) { __IMLOG__(ANDROID_LOG_DEBUG, IM_DEBUG_TAG); } @@ -94,7 +96,7 @@ void ImsMediaTrace::IMLOGD_ARG(const char* format, ...) { - if (gLogMode <= kLogEnableDebug) + if (IM_IS_DEBUGGABLE()) { __IMLOG__(ANDROID_LOG_DEBUG, IM_TAG); }