weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mos...@apache.org
Subject [incubator-weex] 01/01: Optimize iOS logs.
Date Wed, 11 Sep 2019 10:36:14 GMT
This is an automated email from the ASF dual-hosted git repository.

moshen pushed a commit to branch optimize-tlog
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git

commit 3adeb8a1d4c1e6d36aadea50e15944243867298c
Author: qianyuan.wqy <qianyuan.wqy@taobao.com>
AuthorDate: Wed Sep 11 18:35:56 2019 +0800

    Optimize iOS logs.
---
 ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m  |  5 ++++
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m      | 14 ++++++++++-
 .../WeexSDK/Sources/Performance/WXApmForInstance.m |  1 +
 weex_core/Source/core/bridge/script_bridge.h       |  1 -
 .../render/action/render_action_createfinish.cpp   |  1 -
 .../Source/core/render/manager/render_manager.cpp  | 28 ++++++++++++++--------
 6 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m
index c53229d..207abab 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXBridgeManager.m
@@ -530,6 +530,8 @@ void WXPerformBlockSyncOnBridgeThreadForInstance(void (^block) (void),
NSString*
 
 - (void)registerService:(NSString *)name withService:(NSString *)serviceScript withOptions:(NSDictionary
*)options completion:(void(^)(BOOL result))completion
 {
+    WXLogInfo(@"Register service: %@, options: %@", name, options);
+    
     if (!name || !serviceScript || !options) {
         if (completion) {
             completion(NO);
@@ -557,6 +559,7 @@ void WXPerformBlockSyncOnBridgeThreadForInstance(void (^block) (void),
NSString*
 {
     if (!name) return;
     
+    WXLogInfo(@"Unregister service: %@", name);
     NSString *script = [WXServiceFactory unregisterServiceScript:name];
     
     __weak typeof(self) weakSelf = self;
@@ -575,6 +578,7 @@ void WXPerformBlockSyncOnBridgeThreadForInstance(void (^block) (void),
NSString*
     if (!modules) return;
     
     modules = [WXUtility convertContainerToImmutable:modules];
+    WXLogInfo(@"Register modules: %@", modules);
     
     __weak typeof(self) weakSelf = self;
     WXPerformBlockOnBridgeThread(^(){
@@ -590,6 +594,7 @@ void WXPerformBlockSyncOnBridgeThreadForInstance(void (^block) (void),
NSString*
     if (!components) return;
     
     components = [WXUtility convertContainerToImmutable:components];
+    WXLogInfo(@"Register components: %@", components);
     
     __weak typeof(self) weakSelf = self;
     WXPerformBlockOnBridgeThread(^(){
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 0bcda66..1824b13 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -124,6 +124,8 @@ typedef enum : NSUInteger {
             }
         }
         
+        WXLogInfo(@"Create instance: %@, render type: %@", _instanceId, _renderType);
+        
         // TODO self is retained here.
         [WXSDKManager storeInstance:self forID:_instanceId];
         
@@ -206,6 +208,12 @@ typedef enum : NSUInteger {
     return [NSString stringWithFormat:@"<%@: %p; id = %@; rootView = %p; url= %@>",
NSStringFromClass([self class]), self, _instanceId, (__bridge void*)_rootView, _scriptURL];
 }
 
+- (void)setParentInstance:(WXSDKInstance *)parentInstance
+{
+    WXLogInfo(@"Embed instance %@ into parent instance %@", _instanceId, parentInstance.instanceId);
+    _parentInstance = parentInstance;
+}
+
 #pragma mark Public Mehtods
 
 - (UIView *)rootView
@@ -710,12 +718,13 @@ typedef enum : NSUInteger {
     };
     
     _mainBundleLoader.onFailed = ^(NSError *loadError) {
+        WXLogError(@"Request failed with error: %@", loadError);
+        
         NSString *errorMessage = [NSString stringWithFormat:@"Request to %@ occurs an error:%@,
info:%@", request.URL, loadError.localizedDescription, loadError.userInfo];
         long wxErrorCode = [loadError.domain isEqualToString:NSURLErrorDomain] &&
loadError.code == NSURLErrorNotConnectedToInternet ? WX_ERR_NOT_CONNECTED_TO_INTERNET : WX_ERR_JSBUNDLE_DOWNLOAD;
 
         WX_MONITOR_FAIL_ON_PAGE(WXMTJSDownload, wxErrorCode, errorMessage, weakSelf.pageName);
         
-    
         NSMutableDictionary *allUserInfo = [[NSMutableDictionary alloc] initWithDictionary:error.userInfo];
         [allUserInfo addEntriesFromDictionary:loadError.userInfo];
         NSError *errorWithReportMsg = [NSError errorWithDomain:error.domain
@@ -766,6 +775,8 @@ typedef enum : NSUInteger {
 
 - (void)destroyInstance
 {
+    WXLogInfo(@"Destroy instance: %@", _instanceId);
+    
     [self.apmInstance endRecord];
     NSString *url = @"";
     if ([WXPrerenderManager isTaskExist:[self.scriptURL absoluteString]]) {
@@ -810,6 +821,7 @@ typedef enum : NSUInteger {
         // Reading config from orange for Release instance in Main Thread or not, for Bug
#15172691 +{
         dispatch_async(dispatch_get_main_queue(), ^{
             [WXSDKManager removeInstanceforID:instanceId];
+            WXLogInfo(@"Finally remove instance: %@", instanceId);
         });
         //+}
     });
diff --git a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
index 15287d9..ad9f01b 100644
--- a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
@@ -257,6 +257,7 @@ NSString* const VALUE_ERROR_CODE_DEFAULT = @"0";
 }
 
 - (void)printRecordStageMap {
+    // These logs are for performance auto-test platforms.
     __weak typeof(self) weakSelf = self;
     WXPerformBlockOnComponentThread(^{
         if (!weakSelf) {
diff --git a/weex_core/Source/core/bridge/script_bridge.h b/weex_core/Source/core/bridge/script_bridge.h
index c1eea10..bcb43e0 100644
--- a/weex_core/Source/core/bridge/script_bridge.h
+++ b/weex_core/Source/core/bridge/script_bridge.h
@@ -175,7 +175,6 @@ class ScriptBridge {
   inline ScriptSide *script_side() { return script_side_.get(); }
 
   inline void set_core_side(CoreSide *core_side) {
-    LOGE("xxx set_core_side is runing and %p", core_side);
     core_side_.reset(core_side);
     core_side_->set_bridge(this);
   }
diff --git a/weex_core/Source/core/render/action/render_action_createfinish.cpp b/weex_core/Source/core/render/action/render_action_createfinish.cpp
index a2b63ef..1147045 100644
--- a/weex_core/Source/core/render/action/render_action_createfinish.cpp
+++ b/weex_core/Source/core/render/action/render_action_createfinish.cpp
@@ -23,7 +23,6 @@
 namespace WeexCore {
 
 RenderActionCreateFinish::RenderActionCreateFinish(const std::string &page_id) {
-  LOGE("RenderActionCreateFinish::RenderActionCreateFinish");
   this->page_id_ = page_id;
 }
 
diff --git a/weex_core/Source/core/render/manager/render_manager.cpp b/weex_core/Source/core/render/manager/render_manager.cpp
index 35ad5f8..3162469 100644
--- a/weex_core/Source/core/render/manager/render_manager.cpp
+++ b/weex_core/Source/core/render/manager/render_manager.cpp
@@ -48,6 +48,8 @@ bool RenderManager::CreatePage(const std::string& page_id, const char
*data) {
   LOGD("[RenderManager] CreatePage >>>> pageId: %s, dom data: %s",
        pageId.c_str(), parser.toStringUTF8().c_str());
 #endif
+  
+  LOGI("RenderManager::CreatePage, id: %s", page_id.c_str());
     
   std::string targetName = RenderTargetManager::getRenderTargetName(page_id);
   if (!targetName.empty()) {
@@ -95,6 +97,8 @@ bool RenderManager::CreatePage(const std::string& page_id, RenderObject
*root) {
   LOGD("[RenderManager] CreatePage >>>> pageId: %s, dom data: %s",
        pageId.c_str(), parser.toStringUTF8().c_str());
 #endif
+  
+  LOGI("RenderManager::CreatePage, id: %s", page_id.c_str());
 
   RenderPage *page = new RenderPage(page_id);
   this->pages_.insert(std::pair<std::string, RenderPage *>(page_id, page));
@@ -108,23 +112,27 @@ bool RenderManager::CreatePage(const std::string& page_id, std::function<RenderO
 #if RENDER_LOG
     LOGD("[RenderManager] CreatePage >>>> pageId: %s", pageId.c_str());
 #endif
+  
+  LOGI("RenderManager::CreatePage, id: %s", page_id.c_str());
     
-    RenderPage *page = new RenderPage(page_id);
-    this->pages_.insert(std::pair<std::string, RenderPage *>(page_id, page));
+  RenderPage *page = new RenderPage(page_id);
+  this->pages_.insert(std::pair<std::string, RenderPage *>(page_id, page));
 
-    initDeviceConfig(page, page_id);
-    
-    int64_t start_time = getCurrentTime();
-    RenderObject *root = constructRoot(page);
-    page->ParseJsonTime(getCurrentTime() - start_time);
-    
-    return page->CreateRootRender(root);
+  initDeviceConfig(page, page_id);
+  
+  int64_t start_time = getCurrentTime();
+  RenderObject *root = constructRoot(page);
+  page->ParseJsonTime(getCurrentTime() - start_time);
+  
+  return page->CreateRootRender(root);
 }
 
 RenderPageCustom* RenderManager::CreateCustomPage(const std::string& page_id, const std::string&
page_type) {
 #if RENDER_LOG
     LOGD("[RenderManager] CreateCustomPage >>>> pageId: %s, pageType: %s", pageId.c_str(),
page_type.c_str());
 #endif
+  
+  LOGI("RenderManager::CreateCustomPage, id: %s, type: %s", page_id.c_str(), page_type.c_str());
     
     RenderPageCustom::PageOptions options;
     
@@ -382,7 +390,7 @@ bool RenderManager::CreateFinish(const std::string &page_id) {
   RenderPageBase *page = GetPage(page_id);
   if (page == nullptr) return false;
 
-  LOGE("RenderManager::CreateFinish %s", page_id.data());
+  LOGI("RenderManager::CreateFinish, id: %s", page_id.data());
 
 #if RENDER_LOG
   LOGD("[RenderManager] CreateFinish >>>> pageId: %s", pageId.c_str());


Mime
View raw message