当前位置:   article > 正文

android ndk logcat,Android NDK __android_log_print function and LogCat

android ndk logcat,Android NDK __android_log_print function and LogCat

问题

I have a function like

__android_log_print(ANDROID_LOG_INFO, "HelloNDK!");

on my C code

I wouldn't find that output on my LogCat. What kind of filter I need to setup

by Log Tag, by Log Message, by Application Name, by Log Level...etc.

回答1:

You don't find output because you have misused the function. The function has the prototype:

int __android_log_print(int prio, const char *tag, const char *fmt, ...);

So you must supply a "tag" as well as the format.

For example

__android_log_print(ANDROID_LOG_INFO, "MyTag", "The value is %d", some_variable);

Once you use the function properly, you can use any filtering method (or none at all - such as you'd get from the adb logcat command without further arguments) just as with java code.

来源:https://stackoverflow.com/questions/16720854/android-ndk-android-log-print-function-and-logcat

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/674554
推荐阅读
相关标签
  

闽ICP备14008679号