DEBUG_LEVEL 0 to produce no logs

In accordance to gps.conf, debug level of 0 now
produces no logs at all. In addition, if the
parameter DEBUG_LEVEL is commented in gps.conf,
logs will be printed according to Android's logging
levels

CRs-fixed: 503157
Change-Id: I26ca2be67fbc7ce2bf633f66d9b88ca6450e9d27
This commit is contained in:
Tushar Janefalkar 2013-06-20 17:24:37 -07:00
parent 711863f2f3
commit 6fa0e8a983
5 changed files with 21 additions and 12 deletions

View file

@ -18,6 +18,7 @@ NTP_SERVER=time.gpsonextra.net
# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info # DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
# 4 - Debug, 5 - Verbose # 4 - Debug, 5 - Verbose
# If DEBUG_LEVEL is commented, Android's logging levels will be used
DEBUG_LEVEL = 3 DEBUG_LEVEL = 3
# Intermediate position report, 1=enable, 0=disable # Intermediate position report, 1=enable, 0=disable

View file

@ -265,8 +265,9 @@ extern "C" const GpsInterface* get_gps_interface()
if((target == TARGET_APQ8064_STANDALONE) || (target == TARGET_APQ8030_STANDALONE)) { if((target == TARGET_APQ8064_STANDALONE) || (target == TARGET_APQ8030_STANDALONE)) {
gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB); gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
gss_fd = open("/dev/gss", O_RDONLY); gss_fd = open("/dev/gss", O_RDONLY);
if (gss_fd < 0) if (gss_fd < 0) {
LOC_LOGE("GSS open failed: %s\n", strerror(errno)); LOC_LOGE("GSS open failed: %s\n", strerror(errno));
}
else { else {
LOC_LOGD("GSS open success! CAPABILITIES %0lx\n", gps_conf.CAPABILITIES); LOC_LOGD("GSS open success! CAPABILITIES %0lx\n", gps_conf.CAPABILITIES);
} }

View file

@ -57,8 +57,9 @@ int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
int ret_val = -1; int ret_val = -1;
loc_eng_xtra_data_s_type *xtra_module_data_ptr; loc_eng_xtra_data_s_type *xtra_module_data_ptr;
if(callbacks == NULL) if(callbacks == NULL) {
LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL"); LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
}
else { else {
xtra_module_data_ptr = &loc_eng_data.xtra_module_data; xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb; xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;

View file

@ -47,7 +47,7 @@
*============================================================================*/ *============================================================================*/
/* Parameter data */ /* Parameter data */
static uint8_t DEBUG_LEVEL = 3; static uint8_t DEBUG_LEVEL = 0xff;
static uint8_t TIMESTAMP = 0; static uint8_t TIMESTAMP = 0;
/* Parameter spec table */ /* Parameter spec table */

View file

@ -78,23 +78,29 @@ extern char* get_timestamp(char* str, unsigned long buf_size);
#ifndef DEBUG_DMN_LOC_API #ifndef DEBUG_DMN_LOC_API
/* LOGGING MACROS */ /* LOGGING MACROS */
#define LOC_LOGE(...) ALOGE("E/"__VA_ARGS__) /*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
if that value remains unchanged, it means gps.conf did not
provide a value and we default to the initial value to use
Android's logging levels*/
#define LOC_LOGE(...) \
if ((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("W/"__VA_ARGS__); }
#define LOC_LOGW(...) \ #define LOC_LOGW(...) \
if (loc_logger.DEBUG_LEVEL >= 2) { ALOGE("W/"__VA_ARGS__); } \ if ((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL <= 0) { ALOGW("W/"__VA_ARGS__); } else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/"__VA_ARGS__); }
#define LOC_LOGI(...) \ #define LOC_LOGI(...) \
if (loc_logger.DEBUG_LEVEL >= 3) { ALOGE("I/"__VA_ARGS__); } \ if ((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("I/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL <= 0) { ALOGI("I/"__VA_ARGS__); } else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/"__VA_ARGS__); }
#define LOC_LOGD(...) \ #define LOC_LOGD(...) \
if (loc_logger.DEBUG_LEVEL >= 4) { ALOGE("D/"__VA_ARGS__); } \ if ((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("D/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL <= 0) { ALOGD("D/"__VA_ARGS__); } else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/"__VA_ARGS__); }
#define LOC_LOGV(...) \ #define LOC_LOGV(...) \
if (loc_logger.DEBUG_LEVEL >= 5) { ALOGE("V/"__VA_ARGS__); } \ if ((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("V/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL <= 0) { ALOGV("V/"__VA_ARGS__); } else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/"__VA_ARGS__); }
#else /* DEBUG_DMN_LOC_API */ #else /* DEBUG_DMN_LOC_API */