Shorter macros are available for logcat login. This example works in kitkat (4.4.2)
#define LOG_TAG "my_log_tag" #include <cutils/log.h> ALOGD("Format this %d, some_int);
In Android.mk, add the liblog library to LOCAL_SHARED_LIBRARIES when creating in 'mydroid' (a complete build of the Android system). In the case of the ndk build, LOCAL_LDLIBS: = -L $ (SYSROOT) / usr / lib -llog can be used.
include $(CLEAR_VARS) LOCAL_MODULE := foo LOCAL_SRC_FILES := foo.c
There are various other macros defined for all levels of logging. From cutils/log.h :
#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) #define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) ... #define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
gfrigon Mar 31 '15 at 1:05 2015-03-31 01:05
source share