Monday, December 05, 2011

How to add log in Android and look by using C/C++


To add log in Android for debug purpose.

world.c
#include <cutils/log.h>
#define LOG_TAG "world"
int main()
{
   LOGI("test");
   LOGI("Hello world");
   return 0;
}

After add the above code, to compile and run in Android, we can see the message after type the following command.

/ # logcat -v time
10-14 08:29:31.718 I/world ( 2888): test
10-14 08:29:31.718 I/world ( 2888): Hello world

No comments: