From 581ea51a6283b4f22e0771b89cd4ef833fc909bd Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Mon, 9 Jan 2017 19:17:20 -0800 Subject: [PATCH] msm8974-common: gps: LOC logging macro changes The current logging macro always uses LOGE, which is confusing to external developer looking at our logs. Also changed LOC_LOGx definition to follow the same syntax as that of LOC_LOGX. Bug: 29499503 Change-Id: I803233a9d0b241bf9aeb2ee0d4bd2e7cc52ed75b CRs-Fixed: 1113702 --- gps/utils/log_util.h | 58 ++++++++++++++------------------------------ 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/gps/utils/log_util.h b/gps/utils/log_util.h index ffd5ca9..0d59f01 100644 --- a/gps/utils/log_util.h +++ b/gps/utils/log_util.h @@ -99,46 +99,24 @@ extern char* get_timestamp(char* str, unsigned long buf_size); provide a value and we default to the initial value to use Android's logging levels*/ #define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) - #define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) - #define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) - #define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) - #define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) -#define LOC_LOGE(...) \ -IF_LOC_LOGE { ALOGE("E/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("E/" __VA_ARGS__); } - -#define LOC_LOGW(...) \ -IF_LOC_LOGW { ALOGE("W/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/" __VA_ARGS__); } - -#define LOC_LOGI(...) \ -IF_LOC_LOGI { ALOGE("I/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/" __VA_ARGS__); } - -#define LOC_LOGD(...) \ -IF_LOC_LOGD { ALOGE("D/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/" __VA_ARGS__); } - -#define LOC_LOGV(...) \ -IF_LOC_LOGV { ALOGE("V/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); } +#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); } +#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); } +#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); } +#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); } +#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); } #else /* DEBUG_DMN_LOC_API */ -#define LOC_LOGE(...) ALOGE("E/" __VA_ARGS__) - -#define LOC_LOGW(...) ALOGW("W/" __VA_ARGS__) - -#define LOC_LOGI(...) ALOGI("I/" __VA_ARGS__) - -#define LOC_LOGD(...) ALOGD("D/" __VA_ARGS__) - -#define LOC_LOGV(...) ALOGV("V/" __VA_ARGS__) +#define LOC_LOGE(...) ALOGE(__VA_ARGS__) +#define LOC_LOGW(...) ALOGW(__VA_ARGS__) +#define LOC_LOGI(...) ALOGI(__VA_ARGS__) +#define LOC_LOGD(...) ALOGD(__VA_ARGS__) +#define LOC_LOGV(...) ALOGV(__VA_ARGS__) #endif /* DEBUG_DMN_LOC_API */ @@ -163,22 +141,22 @@ else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); } #define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL) #define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL) -#define ENTRY_LOG() LOG_V(ENTRY_TAG, __func__, %s, "") -#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL) +#define ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "") +#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL) #define EXIT_LOG_WITH_ERROR(SPEC, VAL) \ if (VAL != 0) { \ - LOG_E(EXIT_ERROR_TAG, __func__, SPEC, VAL); \ + LOG_E(EXIT_ERROR_TAG, __FUNCTION__, SPEC, VAL); \ } else { \ - LOG_V(EXIT_TAG, __func__, SPEC, VAL); \ + LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL); \ } // Used for logging callflow from Android Framework -#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __func__, %s, "") +#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "") // Used for logging callflow to Modem -#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __func__, SPEC, VAL) -// Used for logging callflow from Modem(TO_MODEM, __func__, %s, "") -#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __func__, SPEC, VAL) +#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __FUNCTION__, SPEC, VAL) +// Used for logging callflow from Modem(TO_MODEM, __FUNCTION__, %s, "") +#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __FUNCTION__, SPEC, VAL) // Used for logging callflow to Android Framework #define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL)