java - What is in android.util.Log#println_native()? -


here android.util.log source code.

at bottom (line 340), in method:

public static native int println_native(int bufid,         int priority, string tag, string msg); 

i guess println_native() more or less println(), int bufid different.

but got codes of println_native(), still lack com.android.internal.os.runtimeinit (line 19, import) simulate android.util.log in old android version.

just did digging in android source code. 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 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 passes arguments driver in system goes , writes log buffer. log buffer pointed /dev/log in linux kernel.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -