mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-16 18:50:07 +08:00
configure glog sink for custom jsc
Reviewed By: alexeylang Differential Revision: D3789493 fbshipit-source-id: b3ecbd1caddfeef5e948e43444be95207c573f67
This commit is contained in:
committed by
Facebook Github Bot 9
parent
6897f40af7
commit
7db93a376b
@@ -16,6 +16,12 @@
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if HAS_FBGLOG
|
||||
#import <FBGLog/FBGLogSink.h>
|
||||
|
||||
typedef void (*configureJSCLoggingForIOSFuncType)(int32_t, std::unique_ptr<google::LogSink>, void (*)());
|
||||
#endif
|
||||
|
||||
static void *RCTCustomLibraryHandler(void)
|
||||
{
|
||||
static dispatch_once_t token;
|
||||
@@ -88,6 +94,18 @@ static void RCTSetUpCustomLibraryPointers(RCTJSCWrapper *wrapper)
|
||||
wrapper->JSContext = (__bridge Class)dlsym(libraryHandle, "OBJC_CLASS_$_JSContext");
|
||||
wrapper->JSValue = (__bridge Class)dlsym(libraryHandle, "OBJC_CLASS_$_JSValue");
|
||||
wrapper->configureJSContextForIOS = (configureJSContextForIOSFuncType)dlsym(libraryHandle, "configureJSContextForIOS");
|
||||
|
||||
#if HAS_FBGLOG
|
||||
static dispatch_once_t once;
|
||||
dispatch_once(&once, ^{
|
||||
void *handle = dlsym(libraryHandle, "configureJSCLoggingForIOS");
|
||||
|
||||
if (handle) {
|
||||
configureJSCLoggingForIOSFuncType logConfigFunc = (configureJSCLoggingForIOSFuncType)handle;
|
||||
logConfigFunc(google::GLOG_INFO, FBGLogSink(), FBGLogFailureFunction);
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
RCTJSCWrapper *RCTJSCWrapperCreate(BOOL useCustomJSC)
|
||||
|
||||
Reference in New Issue
Block a user