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
This commit is contained in:
Mark Salyzyn 2015-02-09 15:15:56 -08:00
parent f5af82edf3
commit 1df92e523e
1 changed files with 16 additions and 1 deletions

View File

@ -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)