Android调试源码正确姿势打开ALOGV
前言
当我沉浸在Android C++的世界中,准备通过其相关的ALOGV日志显示出来的时候,却发现怎么在logcat里面也找不到相关的日志,也许对Android ALOG日志有一定了解的会说实在不行通过ALOGD,ALOGW,ALOGE显示出来不就好了。这个是可以做到,但是不能通过相关的宏进行控制不是十分友好,而且如果Android原来的ALOGV打印的很多,难不成一个个的去修改。在本篇章我将带领打过彻底了解ALOGV的控制机制。
注意:ALOG日志等级的优先级秉承如下的顺序:
ALOGV < ALOGD < ALOGW < ALOGE
一.ALOGV控制相关代码
ALOG相关定义在system/core/include/log/log.h里面,具体如下:
#ifndef LOG_NDEBUG
#ifdef NDEBUG
#define LOG_NDEBUG 1
#else
#define LOG_NDEBUG 0
#endif
#endif
/*
* This is the local tag used for the following simplified
* logging macros. You can change this preprocessor definition
* before using the other macros to change the tag.
*/
#ifndef LOG_TAG
#define LOG_TAG NULL
#endif
#ifndef