Clean up unnecessary logs.
authorTaejeong Lee <taejeong.lee@samsung.com>
Tue, 21 May 2013 02:37:01 +0000 (11:37 +0900)
committerTaejeong Lee <taejeong.lee@samsung.com>
Tue, 21 May 2013 05:11:11 +0000 (14:11 +0900)
[Issue#] N/A
[Problem] Performance
[Cause] N/A
[Solution] Clean up unnecessary logs.

Change-Id: I28f55bfcdfe03f7955332a267cc5de2ea5ea34e4

src/Commons/JSObjectDeclaration.cpp [changed mode: 0644->0755]
src/plugin-loading/plugin.cpp

old mode 100644 (file)
new mode 100755 (executable)
index 2ca8c9e..09f5ff8
@@ -35,7 +35,6 @@ JSObjectDeclaration::JSObjectDeclaration(js_entity_definition_ptr_t classD) :
         m_classTemplate = classD->js_class_template_getter_fun();
     }
     if (classD->class_options) {
-        LogDebug("class options is not a null");
         m_options = OptionsPtr(new Options(classD->class_options));
     }
 }
index 3a7ab0d..16b92e6 100644 (file)
@@ -56,6 +56,8 @@ Plugin::~Plugin()
 
 PluginPtr Plugin::LoadFromFile(const std::string& fileName)
 {
+    static bool logEnable = (getenv("WRT_LOAD_PLUGINS_LOG_ENABLE") != NULL);
+
     LogDebug("LoadFromFile" << fileName);
 
     void *dllHandle;
@@ -103,29 +105,36 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
 
     if (getWidgetEntityMapProcPtr) {
         rawClassList = (*getWidgetEntityMapProcPtr)();
-        LogDebug(
+
+        if (logEnable)
+        {
+            LogDebug(
             "rawClassList : " << rawClassList <<
             "by getWidgetClassMapProcPtr()");
+        }
     } else {
         rawClassList =
             static_cast<const js_entity_definition_t *>(dlsym(dllHandle,
                                                               PLUGIN_CLASS_MAP_NAME));
-        LogDebug("rawClassList : " << rawClassList);
+        if (logEnable) { LogDebug("rawClassList : " << rawClassList); }
     }
 
     if (NULL == onWidgetStartProcPtr || NULL == onWidgetStopProcPtr ||
         /*NULL == onWidgetInitProcPtr ||*/ NULL == rawClassList)
     {
-        LogWarning("#####");
-        LogWarning(
-            "##### Warning: The following plugin does not support new plugin API.");
-        LogWarning(
-            "##### Old plugin API is deprecated. Please update it to new API");
-        LogWarning("#####");
-        LogWarning(
-            "##### Plugin: " << fileName <<
-            " has got deprecated or invalid API");
-        LogWarning("#####");
+        if (logEnable)
+        {
+            LogWarning("#####");
+            LogWarning(
+                "##### Warning: The following plugin does not support new plugin API.");
+            LogWarning(
+                "##### Old plugin API is deprecated. Please update it to new API");
+            LogWarning("#####");
+            LogWarning(
+                "##### Plugin: " << fileName <<
+                " has got deprecated or invalid API");
+            LogWarning("#####");
+        }
 
         // Will not load plugin
         dlclose(dllHandle);
@@ -134,17 +143,20 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
         return empty;
     }
 
-    LogInfo("#####");
-    LogInfo("##### Plugin: " << fileName << " supports new plugin API");
-    LogInfo("#####");
-    LogInfo("##### $onWidgetStartProc: " << onWidgetStartProcPtr);
-    LogInfo("##### $onWidgetInitProc: " << onWidgetInitProcPtr);
-    LogInfo("##### $onWidgetStopProc " << onWidgetStopProcPtr);
-    LogInfo("##### $onFrameLoadProc " << onFrameLoadProcPtr);
-    LogInfo("##### $onFrameUnloadProc " << onFrameUnloadProcPtr);
-    LogInfo("##### $classMap: " << reinterpret_cast<const void *>(rawClassList));
-    LogInfo("##### ");
-    LogInfo("##### Class map:");
+    if (logEnable)
+    {
+        LogInfo("#####");
+        LogInfo("##### Plugin: " << fileName << " supports new plugin API");
+        LogInfo("#####");
+        LogInfo("##### $onWidgetStartProc: " << onWidgetStartProcPtr);
+        LogInfo("##### $onWidgetInitProc: " << onWidgetInitProcPtr);
+        LogInfo("##### $onWidgetStopProc " << onWidgetStopProcPtr);
+        LogInfo("##### $onFrameLoadProc " << onFrameLoadProcPtr);
+        LogInfo("##### $onFrameUnloadProc " << onFrameUnloadProcPtr);
+        LogInfo("##### $classMap: " << reinterpret_cast<const void *>(rawClassList));
+        LogInfo("##### ");
+        LogInfo("##### Class map:");
+    }
 
     const js_entity_definition_t *rawEntityListIterator = rawClassList;
     ClassPtrList classList(new Plugin::ClassList());
@@ -153,12 +165,15 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
     while (rawEntityListIterator->parent_name != NULL &&
            rawEntityListIterator->object_name != NULL)
     {
-        // Logging
-        LogInfo("#####");
-        LogInfo("#####     [" << rawEntityListIterator->object_name << "]: ");
-        LogInfo("#####     Interface: " <<
-                rawEntityListIterator->interface_name);
-        LogInfo("#####     Parent: " << rawEntityListIterator->parent_name);
+        if (logEnable)
+        {
+            // Logging
+            LogInfo("#####");
+            LogInfo("#####     [" << rawEntityListIterator->object_name << "]: ");
+            LogInfo("#####     Interface: " <<
+                    rawEntityListIterator->interface_name);
+            LogInfo("#####     Parent: " << rawEntityListIterator->parent_name);
+        }
 
         // Register class
         classList->push_back(ClassPtr(new Class(rawEntityListIterator)));
@@ -167,8 +182,6 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
         ++rawEntityListIterator;
     }
 
-    LogInfo("#####");
-
     // Load export table
     LogDebug("Plugin successfuly loaded");