From 1373d9caa04c2188d9f50d071930cd3f78d0b272 Mon Sep 17 00:00:00 2001 From: Taejeong Lee Date: Tue, 21 May 2013 11:37:01 +0900 Subject: [PATCH] Clean up unnecessary logs. [Issue#] N/A [Problem] Performance [Cause] N/A [Solution] Clean up unnecessary logs. Change-Id: I28f55bfcdfe03f7955332a267cc5de2ea5ea34e4 --- src/Commons/JSObjectDeclaration.cpp | 1 - src/plugin-loading/plugin.cpp | 75 ++++++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 32 deletions(-) mode change 100644 => 100755 src/Commons/JSObjectDeclaration.cpp diff --git a/src/Commons/JSObjectDeclaration.cpp b/src/Commons/JSObjectDeclaration.cpp old mode 100644 new mode 100755 index 2ca8c9e..09f5ff8 --- a/src/Commons/JSObjectDeclaration.cpp +++ b/src/Commons/JSObjectDeclaration.cpp @@ -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)); } } diff --git a/src/plugin-loading/plugin.cpp b/src/plugin-loading/plugin.cpp index 3a7ab0d..16b92e6 100644 --- a/src/plugin-loading/plugin.cpp +++ b/src/plugin-loading/plugin.cpp @@ -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(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(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(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"); -- 2.7.4