diff --git a/framework/ios/base/bridge/HippyBridge.mm b/framework/ios/base/bridge/HippyBridge.mm index 3e82c52130a..a864e4bf0d2 100644 --- a/framework/ios/base/bridge/HippyBridge.mm +++ b/framework/ios/base/bridge/HippyBridge.mm @@ -191,7 +191,7 @@ - (instancetype)initWithDelegate:(id)delegate _valid = YES; _bundlesQueue = [[HippyBundleOperationQueue alloc] init]; _startTime = footstone::TimePoint::SystemNow(); - HP_PERF_LOG("HippyBridge init begin, self:%p", self); + HippyLogInfo(@"HippyBridge init begin, self:%p", self); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(rootViewContentDidAppear:) name:HippyContentDidAppearNotification object:nil]; HippyExecuteOnMainThread(^{ @@ -208,7 +208,7 @@ - (instancetype)initWithDelegate:(id)delegate [HippyBridge setCurrentBridge:self]; [self loadPendingVendorBundleURLIfNeeded]; - HP_PERF_LOG("HippyBridge init end, self:%p", self); + HippyLogInfo(@"HippyBridge init end, self:%p", self); } return self; } @@ -414,7 +414,7 @@ - (void)loadBundleURL:(NSURL *)bundleURL } return; } - HP_PERF_LOG("Begin loading bundle(%s) at %s", HP_CSTR_NOT_NULL(bundleURL.absoluteString.lastPathComponent.UTF8String), HP_CSTR_NOT_NULL(bundleURL.absoluteString.UTF8String)); + HippyLogInfo(@"Begin loading bundle(%s) at %s", HP_CSTR_NOT_NULL(bundleURL.absoluteString.lastPathComponent.UTF8String), HP_CSTR_NOT_NULL(bundleURL.absoluteString.UTF8String)); [_bundleURLs addObject:bundleURL]; dispatch_async(HippyBridgeQueue(), ^{ [self beginLoadingBundle:bundleURL completion:completion]; @@ -452,7 +452,7 @@ - (void)beginLoadingBundle:(NSURL *)bundleURL return; } [strongSelf executeJSCode:script sourceURL:bundleURL onCompletion:^(id result, NSError *error) { - HP_PERF_LOG("End loading bundle(%s) at %s", HP_CSTR_NOT_NULL(bundleURL.absoluteString.lastPathComponent.UTF8String), HP_CSTR_NOT_NULL(bundleURL.absoluteString.UTF8String)); + HippyLogInfo(@"End loading bundle(%s) at %s", HP_CSTR_NOT_NULL(bundleURL.absoluteString.lastPathComponent.UTF8String), HP_CSTR_NOT_NULL(bundleURL.absoluteString.UTF8String)); if (completion) { completion(bundleURL, error); @@ -509,7 +509,7 @@ - (void)loadInstanceForRootView:(NSNumber *)rootTag withProperties:(NSDictionary - (void)innerLoadInstanceForRootView:(NSNumber *)rootTag withProperties:(NSDictionary *)props { HippyAssert(_moduleName, @"module name must not be null"); HippyLogInfo(@"[Hippy_OC_Log][Life_Circle],Running application %@ (%@)", _moduleName, props); - HP_PERF_LOG("Begin loading instance for HippyBridge(%p)", self); + HippyLogInfo(@"Begin loading instance for HippyBridge(%p)", self); NSDictionary *param = @{@"name": _moduleName, @"id": rootTag, @"params": props ?: @{}, @@ -517,7 +517,7 @@ - (void)innerLoadInstanceForRootView:(NSNumber *)rootTag withProperties:(NSDicti footstone::value::HippyValue value = [param toHippyValue]; std::shared_ptr domValue = std::make_shared(value); self.javaScriptExecutor.pScope->LoadInstance(domValue); - HP_PERF_LOG("End loading instance for HippyBridge(%p)", self); + HippyLogInfo(@"End loading instance for HippyBridge(%p)", self); } - (void)rootViewSizeChangedEvent:(NSNumber *)tag params:(NSDictionary *)params { diff --git a/modules/footstone/include/footstone/logging.h b/modules/footstone/include/footstone/logging.h index 91637a34282..9687cde3adf 100644 --- a/modules/footstone/include/footstone/logging.h +++ b/modules/footstone/include/footstone/logging.h @@ -215,7 +215,16 @@ bool ShouldCreateLogMessage(LogSeverity severity); #define HP_CSTR_NOT_NULL( p ) (p ? p : "") + +#ifdef DEBUG + +// enable perf log output in debug mode only #define HP_PERF_LOG(format, ...) \ footstone::LogMessage::LogWithFormat(__FILE_NAME__, __LINE__, "[HP PERF] " format, \ ##__VA_ARGS__) +#else + +#define HP_PERF_LOG(format, ...) + +#endif