summaryrefslogtreecommitdiff
path: root/utils/log_util.h
diff options
context:
space:
mode:
authorTushar Janefalkar <tusharj@codeaurora.org>2014-01-15 10:24:26 -0800
committerTushar Janefalkar <tusharj@codeaurora.org>2014-02-10 10:15:54 -0800
commit4460543e7d99864f2dee3b3b36fea3aeda34fedf (patch)
tree4472dd85ed2ed9564ce2105ee0bc4c94d3744619 /utils/log_util.h
parent7e53be85c98149e6e21172edf2b5deb7768801ef (diff)
downloadgps-4460543e7d99864f2dee3b3b36fea3aeda34fedf.tar.gz
Add new utilities
This change makes modifications to existing utilities and adds a couple of new utilites to help with the launcher Change-Id: Ib65ffe8e60c7e4a824c5c362765df5dcba872424 CRs-fixed: 600179
Diffstat (limited to 'utils/log_util.h')
-rw-r--r--utils/log_util.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/utils/log_util.h b/utils/log_util.h
index 7fb0c78..5606def 100644
--- a/utils/log_util.h
+++ b/utils/log_util.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -96,24 +96,34 @@ extern char* get_timestamp(char* str, unsigned long buf_size);
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 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_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/"__VA_ARGS__); } \
-else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("W/"__VA_ARGS__); }
+IF_LOC_LOGE { ALOGE("E/"__VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("E/"__VA_ARGS__); }
#define LOC_LOGW(...) \
-if ((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/"__VA_ARGS__); } \
+IF_LOC_LOGW { ALOGE("W/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/"__VA_ARGS__); }
#define LOC_LOGI(...) \
-if ((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("I/"__VA_ARGS__); } \
+IF_LOC_LOGI { ALOGE("I/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/"__VA_ARGS__); }
#define LOC_LOGD(...) \
-if ((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("D/"__VA_ARGS__); } \
+IF_LOC_LOGD { ALOGE("D/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/"__VA_ARGS__); }
#define LOC_LOGV(...) \
-if ((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("V/"__VA_ARGS__); } \
+IF_LOC_LOGV { ALOGE("V/"__VA_ARGS__); } \
else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/"__VA_ARGS__); }
#else /* DEBUG_DMN_LOC_API */