Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1df92e52 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

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
parent f5af82ed
Loading
Loading
Loading
Loading
+16 −1
Original line number Original line Diff line number Diff line
@@ -540,8 +540,23 @@ typedef enum {
#define android_btWriteLog(tag, type, payload, len) \
#define android_btWriteLog(tag, type, payload, len) \
    __android_log_btwrite(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
// TODO: remove these prototypes and their users
#define android_testLog(prio, tag) (1)
#define android_writevLog(vec,num) do{}while(0)
#define android_writevLog(vec,num) do{}while(0)
#define android_write1Log(str,len) do{}while (0)
#define android_write1Log(str,len) do{}while (0)
#define android_setMinPriority(tag, prio) do{}while(0)
#define android_setMinPriority(tag, prio) do{}while(0)