我是靠谱客的博主 笑点低月光,最近开发中收集的这篇文章主要介绍android native日志,java - What is in android.util.Log#println_native()? - Stack Overflow,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Just did some digging in the android source code. This function maps to

static jint android_util_Log_println_native(JNIEnv* env, jobject clazz,

jint bufID, jint priority, jstring tagObj, jstring msgObj)

{

const char* tag = NULL;

const char* msg = NULL;

if (msgObj == NULL) {

jniThrowNullPointerException(env, "println needs a message");

return -1;

}

if (bufID < 0 || bufID >= LOG_ID_MAX) {

jniThrowNullPointerException(env, "bad bufID");

return -1;

}

if (tagObj != NULL)

tag = env->GetStringUTFChars(tagObj, NULL);

msg = env->GetStringUTFChars(msgObj, NULL);

int res = __android_log_buf_write(bufID, (android_LogPriority)priority, tag, msg);

if (tag != NULL)

env->ReleaseStringUTFChars(tagObj, tag);

env->ReleaseStringUTFChars(msgObj, msg);

return res;

}

Basically this then passes the arguments to the driver in the system which goes and writes to the Log buffer. Log buffer is pointed by /dev/log in the Linux kernel.

最后

以上就是笑点低月光为你收集整理的android native日志,java - What is in android.util.Log#println_native()? - Stack Overflow的全部内容,希望文章能够帮你解决android native日志,java - What is in android.util.Log#println_native()? - Stack Overflow所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部