Log para utilizar nos codigos JNI do Android

Este cara postou uma dica de como colocar mensagens de log nos codigos JNI do Android:
http://android-harvest.blogspot.com/2011/06/logging-in-native-code-of-android.html

Encontrei esta dica do Eurico Inocêncio :

#include <android/log.h>

#define LOGV(…) __android_log_print(ANDROID_LOG_VERBOSE, “libnav”, __VA_ARGS__)
#define LOGD(…) __android_log_print(ANDROID_LOG_DEBUG , “libnav”, __VA_ARGS__)
#define LOGI(…) __android_log_print(ANDROID_LOG_INFO , “libnav”, __VA_ARGS__)
#define LOGW(…) __android_log_print(ANDROID_LOG_WARN , “libnav”, __VA_ARGS__)
#define LOGE(…) __android_log_print(ANDROID_LOG_ERROR , “libnav”, __VA_ARGS__)

Outra opção que encontrei na Internet foi criar um android_syslog:

void android_syslog(int level, const char *logname, const char *format, …)
{
va_list arglist;

va_start(arglist, format);
__android_log_vprint(level, logname, format, arglist);
va_end(arglist);

return;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s