Shorter macros are available to log in.
#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 building in 'mydroid' (a complete build of the Android system). In case of assembly LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -Llog you can use LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -Llog .
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:01 2015-03-31 01:01
source share