From 1df92e523e7eb4bec70a2fc1d0bbac20d1fe7008 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Mon, 9 Feb 2015 15:15:56 -0800 Subject: [PATCH] log.h: wrap android_testLog around __android_log_is_loggable - take android_testLog from the bonepile and resurrect - android_testLog is used, and makes sense in its current context as a holder for Android Logging policy. - Default level when not specified is ANDROID_LOG_VERBOSE for eng and userdebug, and ANDROID_LOG_DEBUG for user. NB: Properties, which are associated with __android_log_is_loggable are not to be adjusted in user release; it would be useful at that juncture to return a constant of (0) for VERBOSE, and a (1) for others on user builds. Or default level to drop to ANDROID_LOG_DEBUG for all in future. Bug: 17760225 Change-Id: I420b5b8a94d53d664c6a8b13546ebc424a147923 --- include/log/log.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/include/log/log.h b/include/log/log.h index 9e53d7a2d..d95bf1a31 100644 --- a/include/log/log.h +++ b/include/log/log.h @@ -540,8 +540,23 @@ typedef enum { #define android_btWriteLog(tag, type, payload, len) \ __android_log_btwrite(tag, type, payload, len) +/* + * IF_ALOG uses android_testLog, but IF_ALOG can be overridden. + * android_testLog will remain constant in its purpose as a wrapper + * for Android logging filter policy, and can be subject to + * change. It can be reused by the developers that override + * IF_ALOG as a convenient means to reimplement their policy + * over Android. + */ +#if LOG_NDEBUG /* Production *? +#define android_testLog(prio, tag) \ + (__android_log_is_loggable(prio, tag, ANDROID_LOG_DEBUG) != 0) +#else +#define android_testLog(prio, tag) \ + (__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE) != 0) +#endif + // TODO: remove these prototypes and their users -#define android_testLog(prio, tag) (1) #define android_writevLog(vec,num) do{}while(0) #define android_write1Log(str,len) do{}while (0) #define android_setMinPriority(tag, prio) do{}while(0)