configure glog sink for custom jsc

Reviewed By: alexeylang

Differential Revision: D3789493

fbshipit-source-id: b3ecbd1caddfeef5e948e43444be95207c573f67
This commit is contained in:
Ben Nham
2016-08-31 11:24:34 -07:00
committed by Facebook Github Bot 9
parent 6897f40af7
commit 7db93a376b

View File

@@ -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)