diff --git a/gps/utils/log_util.h b/gps/utils/log_util.h index d27c800..8657828 100644 --- a/gps/utils/log_util.h +++ b/gps/utils/log_util.h @@ -81,8 +81,6 @@ extern const char FROM_MODEM[]; extern const char TO_AFW[]; extern const char EXIT_TAG[]; extern const char ENTRY_TAG[]; -extern const char EXIT_ERROR_TAG[]; - /*============================================================================= * * MODULE EXPORTED FUNCTIONS @@ -99,46 +97,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 */ @@ -159,32 +135,19 @@ else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); } } \ } while(0) -#define LOC_LOG_HEAD(tag,fmt) "%s:%d][" tag "] " fmt "\n" -#define LOC_LOGv(tag,fmt,...) LOC_LOGV(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__) -#define LOC_LOGw(tag,fmt,...) LOC_LOGW(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__) -#define LOC_LOGd(tag,fmt,...) LOC_LOGD(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__) -#define LOC_LOGe(tag,fmt,...) LOC_LOGE(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__) #define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL) #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 EXIT_LOG_WITH_ERROR(SPEC, VAL) \ - if (VAL != 0) { \ - LOG_E(EXIT_ERROR_TAG, __func__, SPEC, VAL); \ - } else { \ - LOG_V(EXIT_TAG, __func__, 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)