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

Function InitF2Log

core/android/F2NativeJNI.cpp:624–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622static jmethodID gF2LogErrorMethod = nullptr;
623
624static bool InitF2Log(JNIEnv *env) {
625 if(gF2LogClass != nullptr) {
626 return true;
627 }
628
629 jclass logClass = env->FindClass("com/antgroup/antv/f2/F2Log");
630 if(logClass == nullptr) {
631 return false;
632 }
633
634 // 获取 get() 方法
635 jmethodID getMethod = env->GetStaticMethodID(logClass, "get", "()Lcom/antgroup/antv/f2/service/F2LogService;");
636 if (getMethod == nullptr || jni::HasException(env)) {
637 jni::ClearException(env);
638 return false;
639 }
640
641 // 调用 get() 方法获取 F2LogService 实例
642 jobject f2LogServiceInstance = env->CallStaticObjectMethod(logClass, getMethod);
643 if (f2LogServiceInstance == nullptr || jni::HasException(env)) {
644 jni::ClearException(env);
645 return false;
646 }
647
648 // 获取 F2LogService 接口类
649 jclass f2LogServiceClass = env->FindClass("com/antgroup/antv/f2/service/F2LogService");
650 if (f2LogServiceClass == nullptr || jni::HasException(env)) {
651 jni::ClearException(env);
652 return false;
653 }
654
655 gF2LogInfoMethod = env->GetMethodID(f2LogServiceClass, "i", "(Ljava/lang/String;Ljava/lang/String;)V");
656 gF2LogWarnMethod = env->GetMethodID(f2LogServiceClass, "w", "(Ljava/lang/String;Ljava/lang/String;)V");
657 gF2LogErrorMethod = env->GetMethodID(f2LogServiceClass, "e", "(Ljava/lang/String;Ljava/lang/String;)V");
658 if(HasException(env)) {
659 jni::ClearException(env);
660 return false;
661 }
662
663 gF2LogClass = new ScopedJavaGlobalRef<jobject>(env, f2LogServiceInstance);
664
665 return true;
666}
667
668//###################### F2CanvasView Start ###################################
669static jlong nCreateCanvasContextHandle(JNIEnv *env, jclass clazz, jobject canvasConext) {

Callers 1

OnJniLoadFunction · 0.85

Calls 2

HasExceptionFunction · 0.85
ClearExceptionFunction · 0.85

Tested by

no test coverage detected