MCPcopy Create free account
hub / github.com/antvis/F2Native / InnerLog

Function InnerLog

core/android/F2NativeJNI.cpp:890–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

888}
889
890void InnerLog(int level, std::string traceId, const char *fmt, ...) {
891 std::string _tag = "jni|" + traceId;
892
893 char msg[2048] = {0};
894 va_list args;
895 va_start(args, fmt);
896 vsnprintf(msg, 2048, fmt, args);
897 va_end(args);
898
899 jmethodID method = gF2LogInfoMethod;
900 if(level == F2_LOG_WARN) {
901 method = gF2LogWarnMethod;
902 } else if(level == F2_LOG_ERROR) {
903 method = gF2LogErrorMethod;
904 }
905
906 if(gF2LogClass == nullptr || gF2LogClass->isNull() || method == nullptr) {
907 native_clog(level, _tag.data(), msg);
908 return;
909 }
910
911 JNIEnv *env = GetJniEnvSafe();
912 if(env == nullptr) {
913 return;
914 }
915 ScopedJavaLocalRef<jstring> tagStr = StringToJavaString(env, _tag);
916 ScopedJavaLocalRef<jstring> msgStr = StringToJavaString(env, msg);
917 env->CallVoidMethod(gF2LogClass->obj(), method, tagStr.obj(), msgStr.obj());
918 if(HasException(env)) {
919 jni::ClearException(env);
920 }
921}
922
923static bool OnJniLoad(JNIEnv *env) {
924 if(!InitF2Log(env)) {

Callers

nothing calls this directly

Calls 7

native_clogFunction · 0.85
GetJniEnvSafeFunction · 0.85
StringToJavaStringFunction · 0.85
HasExceptionFunction · 0.85
ClearExceptionFunction · 0.85
isNullMethod · 0.80
objMethod · 0.45

Tested by

no test coverage detected