#include <stdio.h>
#include <android/log.h>
static void jni_trace(const char* fmt, ...)
{
va_list vl;
va_start(vl,fmt);
__android_log_vprint(ANDROID_LOG_ERROR,"ccstroke_algo",fmt,vl);
va_end(vl);
}
C下调用jni_trace函数即可。
本文介绍了一个用于Android环境中JNI层的日志记录函数jni_trace的具体实现。该函数利用宏va_list来支持可变参数列表,并使用__android_log_vprint将带有标签ccstroke_algo和错误级别的日志信息输出到Android系统日志中。从C代码调用此函数可以方便地记录运行时信息。
#include <stdio.h>
#include <android/log.h>
static void jni_trace(const char* fmt, ...)
{
va_list vl;
va_start(vl,fmt);
__android_log_vprint(ANDROID_LOG_ERROR,"ccstroke_algo",fmt,vl);
va_end(vl);
}
804
3761
370

被折叠的 条评论
为什么被折叠?