Replace LogProvider to Dlog
authorJihoon Chung <jihoon.chung@samsaung.com>
Sat, 20 Jul 2013 07:02:11 +0000 (16:02 +0900)
committerJihoon Chung <jihoon.chung@samsaung.com>
Sun, 21 Jul 2013 04:07:21 +0000 (13:07 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Replace LogProvider to Dlog
[SCMRequest] N/A

Change-Id: I183e4442e572f9874ec71daa4d3095b340e6495c

19 files changed:
src/CMakeLists.txt
src/Commons/EventReceiver.h
src/Commons/FunctionDeclaration.h
src/Commons/WrtAccess/WrtAccess.cpp
src/CommonsJavaScript/JSCallbackManager.cpp
src/js-overlay/js_function_manager.cpp
src/modules/tizen/PluginManager/PluginManager.cpp
src/plugin-loading/explorer.cpp
src/plugin-loading/javascript_interface.cpp
src/plugin-loading/js_page_session.cpp
src/plugin-loading/plugin.cpp
src/plugin-loading/plugin_container_support.cpp
src/plugin-loading/plugin_iframe_support.cpp
src/plugin-loading/plugin_logic.cpp
src/plugin-loading/plugin_property_support.cpp
src/plugins-ipc-message/ipc_message_support.cpp
src/standards/W3C/Widget/CMakeLists.txt
src/standards/W3C/Widget/JSPreferences.cpp
src/standards/W3C/Widget/plugin_initializer.cpp

index 5152f7e..ba7daa0 100644 (file)
@@ -13,6 +13,9 @@
 #    limitations under the License.
 #
 # Includes CMake configuration file (*.cmake), preserving appropriate paths.
+
+ADD_DEFINITIONS("-DWRT_PLUGINS_COMMON_LOG")
+
 macro(include_config_file INCLUDED_CONFIG_FILE_PATH)
   get_filename_component(CURRENT_CONFIG_FILE_PATH ${CMAKE_CURRENT_LIST_FILE} PATH)
   include(${CURRENT_CONFIG_FILE_PATH}/${INCLUDED_CONFIG_FILE_PATH}/${CONFIG_FILE_NAME} OPTIONAL)
index f4dfb1f..3d7c67b 100644 (file)
@@ -27,7 +27,7 @@
 #include <dpl/event/controller.h>
 #include <dpl/type_list.h>
 #include <dpl/event/abstract_event_call.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <Commons/ThreadPool.h>
 
 namespace WrtDeviceApis {
@@ -43,7 +43,7 @@ class SignalEventCall : public DPL::Event::AbstractEventCall
     {}
     virtual void Call()
     {
-        LogDebug("signaling in SignalEventCall");
+        _D("signaling in SignalEventCall");
         m_event->signalSynchronousEventFlag();
     }
 };
@@ -69,7 +69,7 @@ class EventReceiver :
 
     void signalEventByDispatcher(const DPL::SharedPtr<TemplateEvent> &event)
     {
-        LogDebug("in");
+        _D("called");
         Try {
             DPL::Event::AbstractEventDispatcher *dispatcher =
                 ThreadPool::getInstance().getDispatcher(m_threadDispatcher);
@@ -78,7 +78,7 @@ class EventReceiver :
         Catch(DPL::Thread::Exception::UnmanagedThread) {
             // if called on unmanaged thread,
             // call signalSynchronousEventFlag() directly
-            LogDebug("signalSynchronousEventFlag() is called"
+            _E("signalSynchronousEventFlag() is called"
                      "by unmanaged thread");
             event->signalSynchronousEventFlag();
         }
@@ -109,13 +109,12 @@ class EventRequestReceiver : private EventReceiver<TemplateEvent>
     void PostRequest(const DPL::SharedPtr<TemplateEvent> &event,
                      double delaySeconds = 0.0)
     {
-        LogDebug(__FUNCTION__);
+        _D("called");
         {
             DPL::Mutex::ScopedLock lock(&event->m_stateMutex);
             assert(TemplateEvent::STATE_INITIAL == event->m_state);
             event->m_state = TemplateEvent::STATE_REQUEST_SEND;
         }
-        LogDebug("state changed to STATE_REQUEST_SEND. Now posting");
 
         if (TemplateEvent::HANDLING_SYNCHRONOUS == event->getHandlingType() &&
             !event->m_synchronousEventFlag)
@@ -132,22 +131,20 @@ class EventRequestReceiver : private EventReceiver<TemplateEvent>
                 ::
                 PostTimedEvent(event, delaySeconds);
         }
-        LogDebug("Event posted.");
+
         switch (event->getHandlingType()) {
         case TemplateEvent::HANDLING_NOT_SET:
             assert(0);
             break;
         case TemplateEvent::HANDLING_SYNCHRONOUS:
-            LogDebug("It's synchronous call - waiting for answer...");
             event->waitForAnswer();
-            LogDebug("...answer received");
             break;
         }
     }
 
     void OnEventReceived(const DPL::SharedPtr<TemplateEvent> &event)
     {
-        LogDebug(__FUNCTION__);
+        _D("called");
         {
             DPL::Mutex::ScopedLock lock(&event->m_stateMutex);
             if (event->m_cancelled) {
@@ -163,7 +160,7 @@ class EventRequestReceiver : private EventReceiver<TemplateEvent>
             }
             event->m_state = TemplateEvent::STATE_REQUEST_RECEIVED;
         }
-        LogDebug("calling OnRequestReceived");
+
         OnRequestReceived(event);
         event->signalCancelStatusFlag();
         //After Controller ends processing it should call it to signal that work
@@ -189,7 +186,7 @@ class EventRequestReceiver : private EventReceiver<TemplateEvent>
                 event->m_state = TemplateEvent::STATE_ANSWER_SEND;
             }
         }
-        LogDebug("choosing the answer method");
+
         switch (event->m_handlingType) {
         case TemplateEvent::HANDLING_NOT_SET:
             assert(0);
@@ -210,14 +207,13 @@ class EventRequestReceiver : private EventReceiver<TemplateEvent>
         // send explicit from the code
         case TemplateEvent::HANDLING_SYNCHRONOUS_MANUAL_ANSWER:
         case TemplateEvent::HANDLING_ASYNCHRONOUS_MANUAL_ANSWER:
-            LogDebug("Manual answer is set so do nothing.");
             break;
         }
     }
 
     virtual void ManualAnswer(const DPL::SharedPtr<TemplateEvent> &event)
     {
-        LogDebug(__FUNCTION__);
+        _D("called");
         assert(
             event->m_handlingType ==
             TemplateEvent::HANDLING_ASYNCHRONOUS_MANUAL_ANSWER ||
@@ -278,10 +274,9 @@ class EventAnswerReceiver : private EventReceiver<TemplateEvent>
 
     void OnEventReceived(const DPL::SharedPtr<TemplateEvent> &event)
     {
-        LogDebug("EventAnswerReceiver: answer received");
+        _D("EventAnswerReceiver: answer received");
         //check if it can be processed and set the state
         {
-            LogDebug("checking the state");
             DPL::Mutex::ScopedLock lock(&event->m_stateMutex);
 
             //in case someone changed it to synchronous call, we don't process
@@ -290,8 +285,6 @@ class EventAnswerReceiver : private EventReceiver<TemplateEvent>
                 event->m_state || TemplateEvent::STATE_ENDED ==
                 event->m_state)
             {
-                LogDebug(
-                    "Handling probably changed to synchronous meanwhile. Will not process it..");
                 return;
             }
             //we should get cancelled or answer_send state here
@@ -306,10 +299,9 @@ class EventAnswerReceiver : private EventReceiver<TemplateEvent>
             }
             event->m_state = TemplateEvent::STATE_ANSWER_RECEIVED;
         }
-        LogDebug("calling OnAnswerReceived");
+
         OnAnswerReceived(event);
 
-        LogDebug("changing the state");
         {
             DPL::Mutex::ScopedLock lock(&event->m_stateMutex);
             assert(TemplateEvent::STATE_ANSWER_RECEIVED == event->m_state);
@@ -319,7 +311,6 @@ class EventAnswerReceiver : private EventReceiver<TemplateEvent>
             //if someone is waiting
             event->signalFinishedFlag();
         }
-        LogDebug("leaving");
     }
 };
 }
index e707fb9..9075268 100644 (file)
@@ -147,10 +147,8 @@ AceSecurityStatus aceCheckAccess(
     argsVerify(aceFunction, args ...);
 
     if (!(WrtAccessSingleton::Instance().checkAccessControl(aceFunction))) {
-        LogDebug("Function is not allowed to run");
-        return AceSecurityStatus::AccessDenied;
+            return AceSecurityStatus::AccessDenied;
     }
-    LogDebug("Function accepted!");
 
     return AceSecurityStatus::AccessGranted;
 }
index b81c368..0e9f50a 100644 (file)
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 
 #include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <dpl/scoped_array.h>
 #include <dpl/scoped_resource.h>
 #include <dpl/assert.h>
@@ -139,14 +140,16 @@ WrtAccess::SessionId WrtAccess::GenerateSessionId()
 
 void WrtAccess::initialize(int widgetId)
 {
-    LogDebug("initialize");
+    _D("initialize");
     if (widgetId < 0) {
-        LogDebug("Invalid widget id");
+        _E("Invalid widget id");
         Throw(Exception);
     }
 
     if (!m_pluginOwners++) {
+        DPL::Log::LogSystemSingleton::Instance().SetTag("SECURITY_DAEMON");
         ace_return_t ret = ace_client_initialize(Wrt::Popup::run_popup);
+        DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS");
         Assert(ACE_OK == ret);
         m_widgetId = widgetId;
     }
@@ -154,10 +157,12 @@ void WrtAccess::initialize(int widgetId)
 
 void WrtAccess::deinitialize(int /*widgetId*/)
 {
-    LogDebug("deinitialize");
+    _D("deinitialize");
 
     if (!--m_pluginOwners) {
+        DPL::Log::LogSystemSingleton::Instance().SetTag("SECURITY_DAEMON");
         ace_return_t ret = ace_client_shutdown();
+        DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS");
         Assert(ACE_OK == ret);
     }
 }
@@ -213,7 +218,7 @@ bool WrtAccess::checkAccessControl(const AceFunction& aceFunction) const
         }
     }
 
-    LogDebug("constructing ACE request");
+    _D("constructing ACE request");
 
     ace_request_t aceRequest;
     aceRequest.session_id =
@@ -245,15 +250,16 @@ bool WrtAccess::checkAccessControl(const AceFunction& aceFunction) const
     }
 
     ace_bool_t aceCheckResult = ACE_FALSE;
+    DPL::Log::LogSystemSingleton::Instance().SetTag("SECURITY_DAEMON");
     ace_return_t ret = ace_check_access(&aceRequest, &aceCheckResult);
-
+    DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS");
     for (i = 0; i < deviceCount; ++i) {
         delete[] aceRequest.dev_cap_list.items[i].param_list.items;
     }
     delete[] aceRequest.dev_cap_list.items;
 
     if (ACE_OK != ret) {
-        LogError("Error in ace check: " << static_cast<int>(ret));
+        _E("Error in ace check: %d", static_cast<int>(ret));
         return false;
     }
     return ACE_TRUE == aceCheckResult;
index 46a28f2..56373e3 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #include "JSCallbackManager.h"
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 
 namespace WrtDeviceApis {
 namespace CommonsJavaScript {
@@ -32,12 +32,9 @@ JSCallbackManagerPtr JSCallbackManager::createObject(
     acceptJSNullAsOnSuccess,
     bool acceptJSNullAsOnError)
 {
-    LogDebug("entered");
     JSObjectRef l_onSuccess = NULL;
     JSObjectRef l_onError = NULL;
 
-    LogDebug("onSuccessCallback ptr=" << onSuccess);
-    LogDebug("onErrorCallback   ptr=" << onError);
     if (NULL != onSuccess &&
         (!acceptJSNullAsOnSuccess || !JSValueIsNull(context, onSuccess)))
     {
@@ -49,7 +46,7 @@ JSCallbackManagerPtr JSCallbackManager::createObject(
                      "success callback is not a function");
         }
     } else {
-        LogWarning("onSuccessCallback is NULL and is not registred");
+        //LogWarning("onSuccessCallback is NULL and is not registred");
     }
     if (NULL != onError &&
         (!acceptJSNullAsOnError || !JSValueIsNull(context, onError)))
@@ -62,7 +59,7 @@ JSCallbackManagerPtr JSCallbackManager::createObject(
                      "error callback is not a function");
         }
     } else {
-        LogWarning("onErrorCallback is NULL and is not registred");
+        //LogWarning("onErrorCallback is NULL and is not registred");
     }
     return JSCallbackManagerPtr(new JSCallbackManager(context, l_onSuccess,
                                                       l_onError));
@@ -76,16 +73,12 @@ JSCallbackManager::JSCallbackManager(JSContextRef context,
     m_context(context),
     m_object(NULL)
 {
-    LogDebug("entered");
-
     setOnSuccess(onSuccess);
     setOnError(onError);
 }
 
 JSCallbackManager::~JSCallbackManager()
 {
-    LogDebug("entered");
-
     if (m_onSuccess) {
         JSValueUnprotect(m_context, m_onSuccess);
     }
@@ -101,7 +94,6 @@ JSCallbackManager::~JSCallbackManager()
 
 void JSCallbackManager::setOnSuccess(JSValueRef onSuccess)
 {
-    LogDebug("entered");
     if (m_onSuccess != NULL) {
         JSValueUnprotect(m_context, m_onSuccess);
     }
@@ -119,13 +111,11 @@ void JSCallbackManager::setOnSuccess(JSValueRef onSuccess)
 
 JSValueRef JSCallbackManager::getOnSuccess() const
 {
-    LogDebug("entered");
     return m_onSuccess;
 }
 
 void JSCallbackManager::setOnError(JSValueRef onError)
 {
-    LogDebug("entered");
     if (m_onError != NULL) {
         JSValueUnprotect(m_context, m_onError);
     }
@@ -143,13 +133,11 @@ void JSCallbackManager::setOnError(JSValueRef onError)
 
 JSValueRef JSCallbackManager::getOnError() const
 {
-    LogDebug("entered");
     return m_onError;
 }
 
 void JSCallbackManager::setObject(JSObjectRef object)
 {
-    LogDebug("entered");
     if (m_object != NULL) {
         JSValueUnprotect(m_context, m_object);
     }
@@ -163,21 +151,18 @@ void JSCallbackManager::setObject(JSObjectRef object)
 
 JSObjectRef JSCallbackManager::getObject() const
 {
-    LogDebug("entered");
     return m_object;
 }
 
 void JSCallbackManager::setContext(JSContextRef context)
 {
-    LogDebug("entered");
     m_context = context;
 }
 
 void JSCallbackManager::callOnSuccess()
 {
-    LogDebug("entered");
     if (m_onSuccess == NULL) {
-        LogDebug("Success callback is not set");
+        //LogDebug("Success callback is not set");
         return;
     }
     makeCallback(m_context, NULL, m_onSuccess, NULL, 0);
@@ -185,9 +170,8 @@ void JSCallbackManager::callOnSuccess()
 
 void JSCallbackManager::callOnSuccess(JSValueRef obj)
 {
-    LogDebug("entered");
     if (m_onSuccess == NULL) {
-        LogDebug("Success callback is not set");
+        //LogDebug("Success callback is not set");
         return;
     }
     JSValueRef objParam[1] = { obj };
@@ -197,9 +181,8 @@ void JSCallbackManager::callOnSuccess(JSValueRef obj)
 void JSCallbackManager::callOnSuccess(JSValueRef obj[],
                                       int paramCount)
 {
-    LogDebug("entered");
     if (m_onSuccess == NULL) {
-        LogDebug("Success callback is not set");
+        //LogDebug("Success callback is not set");
         return;
     }
     makeCallback(m_context, NULL, m_onSuccess, obj, paramCount);
@@ -207,9 +190,8 @@ void JSCallbackManager::callOnSuccess(JSValueRef obj[],
 
 void JSCallbackManager::callOnError()
 {
-    LogDebug("entered");
     if (m_onError == NULL) {
-        LogDebug("Error callback is not set");
+        //LogDebug("Error callback is not set");
         return;
     }
     makeCallback(m_context, NULL, m_onError, NULL, 0);
@@ -217,9 +199,8 @@ void JSCallbackManager::callOnError()
 
 void JSCallbackManager::callOnError(JSValueRef obj)
 {
-    LogDebug("entered");
     if (m_onError == NULL) {
-        LogDebug("Error callback is not set");
+        //LogDebug("Error callback is not set");
         return;
     }
     JSValueRef objParam[1] = { obj };
@@ -229,9 +210,8 @@ void JSCallbackManager::callOnError(JSValueRef obj)
 void JSCallbackManager::callOnError(JSValueRef obj[],
                                     int paramCount)
 {
-    LogDebug("entered");
     if (m_onError == NULL) {
-        LogDebug("Error callback is not set");
+        //LogDebug("Error callback is not set");
         return;
     }
     makeCallback(m_context, NULL, m_onError, obj, paramCount);
@@ -243,19 +223,15 @@ void JSCallbackManager::makeCallback(JSContextRef context,
                                      JSValueRef argv[],
                                      unsigned argc)
 {
-    LogDebug("entered");
-
     if (callback == NULL) {
-        LogError("callback is NULL");
+        //LogError("callback is NULL");
         return;
     }
 
     if (JSObjectIsFunction(context, callback)) {
         if (argc == 0) {
-            LogDebug("Calling object directly, no arguments");
             JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL);
         } else {
-            LogDebug("Calling object directly, one argument");
             JSObjectCallAsFunction(context, callback, object, argc, argv, NULL);
         }
         return;
index 222c607..dab34b9 100644 (file)
@@ -25,6 +25,7 @@
 #include <js_function_manager.h>
 #include <js_overlay_functions.h>
 #include <wrt_plugin_export.h>
+#include <dpl/log/secure_log.h>
 
 IMPLEMENT_SAFE_SINGLETON(JsFunctionManager)
 
@@ -80,7 +81,7 @@ const js_entity_definition_ptr_t jsHookPtr = &jsHook;
 
 bool JsFunctionManager::initialize()
 {
-    LogDebug("JSObjectDeclaration for js functions are intialized");
+    _D("JSObjectDeclaration for js functions are intialized");
     JSObjectDeclarationPtr jsPrintObj(
         new JSObjectDeclaration(JavaScriptFunctions::jsPrintPtr));
 
@@ -95,7 +96,7 @@ bool JsFunctionManager::initialize()
 
 JsFunctionManager::Functions JsFunctionManager::getFunctions()
 {
-    LogDebug("get standard js fucntions");
+    _D("get standard js fucntions");
     static bool initialized = initialize();
     (void) initialized;
     return m_functions;
index 6723c29..6e2c97c 100644 (file)
@@ -31,7 +31,7 @@
 #include <Commons/Exception.h>
 #include <CommonsJavaScript/Converter.h>
 #include <dpl/exception.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <dpl/foreach.h>
 
 using namespace std;
@@ -74,14 +74,14 @@ bool PluginManager::hasChild(const string &name) const
 
 bool PluginManager::loadChild(const string &name) const
 {
-    LogDebug("loading " << name);
+    _D("loading %s", name.c_str());
     string localUri = m_objectUri;
     localUri.append(SEPARATOR).append(name);
 
     WrtDB::DbPluginHandle handle =
         WrtDB::PluginDAOReadOnly::getPluginHandleForImplementedObject(localUri);
     if (handle == WrtDB::INVALID_PLUGIN_HANDLE) {
-        LogError("Plugin not found");
+        _E("Plugin not found");
         return false;
     }
 
@@ -97,7 +97,7 @@ bool PluginManager::loadChild(const string &name) const
     {
         // Error while reading database - widget handle may
         // be invalid or some data may be missing in database
-        LogError("Cannot get feature list");
+        _E("Cannot get feature list");
         return false;
     }
 
@@ -113,7 +113,7 @@ bool PluginManager::loadChild(const string &name) const
     {
         if (it->pluginId == handle) {
             if (it->rejected) {
-                LogWarning("Feature rejected by ACE");
+                _E("Feature rejected by ACE");
                 continue;
             }
 
@@ -125,13 +125,13 @@ bool PluginManager::loadChild(const string &name) const
                        const_cast<JSGlobalContextRef>(m_context));
         }
     }
-    LogError("Plugin not loaded");
+    _E("Plugin not loaded");
     return false;
 }
 
 JSValueRef PluginManager::getProperty(const string &name) const
 {
-    LogDebug("getProperty " << name);
+    _D("getProperty %s", name.c_str());
     ObjectList::const_iterator it = m_objectList.find(name);
     if (it != m_objectList.end()) {
         //return already set value
@@ -154,7 +154,7 @@ JSValueRef PluginManager::getProperty(const string &name) const
 bool PluginManager::setProperty(const string &name,
                                 JSValueRef value)
 {
-    LogDebug("setProperty " << name);
+    _D("setProperty %s", name.c_str());
     if (m_objectList.count(name) > 0) {
         JSValueUnprotect(m_context, m_objectList[name]);
     }
@@ -166,7 +166,7 @@ bool PluginManager::setProperty(const string &name,
 bool PluginManager::deleteProperty(const string &name)
 {
     if (m_objectList.count(name) > 0) {
-        LogDebug("deleteProperty " << name);
+        _D("deleteProperty %s", name.c_str());
         JSValueUnprotect(m_context, m_objectList[name]);
         m_objectList.erase(name);
         return true;
@@ -220,7 +220,7 @@ Api::IPluginManager::PropertyList PluginManager::getProperties() const
         }
         Catch(WidgetDAOReadOnly::Exception::Base)
         {
-            LogError("Cannot get feature list");
+            _E("Cannot get feature list");
             ReThrow(Commons::PlatformException);
         }
 
index a87ceee..a36aecc 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <algorithm>
 #include <dpl/foreach.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include "explorer.h"
 #include "plugin_property_support.h"
 
@@ -43,7 +43,7 @@ Explorer::Explorer(JSGlobalContextRef context) :
     m_context(context)
 {
     if (!context) {
-        LogError("Context is NULL");
+        _W("Context is NULL");
         return;
     }
 
@@ -71,10 +71,10 @@ JSObjectPtr Explorer::getProperty(
     const string& requestedProperty,
     JSObjectPtr providedObject)
 {
-    LogDebug("Requested Property: " << requestedProperty);
+    _D("Requested Property: %s", requestedProperty.c_str());
 
     if (!providedObject) {
-        LogError("Provided object is empty");
+        _W("Provided object is empty");
         return JSObjectPtr();
     }
 
@@ -92,14 +92,14 @@ JSObjectPtr Explorer::getProperty(
         currentObjectName = currentPropertyRequested.substr(0, pos);
 
         if (currentPropertyRequested.size() <= pos + 1) {
-            LogError("Wrong name of requested property");
+            _W("Wrong name of requested property");
             return JSObjectPtr();
         }
         currentPropertyRequested = currentPropertyRequested.substr(pos + 1);
 
         currentObject = getJSObjectProperty(currentObjectName, currentObject);
         if (!currentObject) {
-            LogError("Failed to get property: " << currentObjectName);
+            _W("Failed to get property: %s", currentObjectName.c_str());
             return JSObjectPtr();
         }
     }
@@ -117,7 +117,7 @@ bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration,
         string masterName = declaration->getParentName();
         auto pos = masterName.find(".");
         if (string::npos != pos) {
-            LogError("ParentName not allowed");
+            _W("ParentName not allowed");
             return false;
         }
         auto masterObject = getJSObjectProperty(masterName, m_globalObject);
@@ -145,31 +145,26 @@ bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration,
                               JSObjectPtr providedObject,
                               JSGlobalContextRef context)
 {
-    LogDebug("'" << providedObjectName << "' <- '" << declaration->getName() << "'");
-
+    _D("%s <- %s", providedObjectName.c_str(), declaration->getName().c_str());
     std::string fullParentName = declaration->getParentName();
 
     if (fullParentName == providedObjectName) {
+        \r_D("Provided object was matched!!");
         return register_(declaration, providedObject, context);
     }
 
-    LogDebug("Provided object was not matched!!");
-
     //check if object exists in fullParentName
     auto pos = fullParentName.find(providedObjectName);
     if (pos == string::npos) {
-        LogError(
-            "Object: " << declaration->getName()
-                       << " should be child of: " <<
-            declaration->getParentName()
-                       << " but you provided object: " <<
-            providedObjectName);
-
+        _W("Object: %s should be child of: %s but you provided object: %s",
+           declaration->getName().c_str(),
+           declaration->getParentName().c_str(),
+           providedObjectName.c_str());
         return false;
     }
 
     if (fullParentName.size() <= pos + providedObjectName.size() + 1) {
-        LogError("Invalid object name");
+        _W("Invalid object name");
         return false;
     }
 
@@ -180,14 +175,10 @@ bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration,
             currentRequesteProperty, providedObject);
 
     if (!jsObject->getObject()) {
-        LogError(
-            "Object: '" << declaration->getName()
-                        << "' should be child of: '" <<
-            declaration->getParentName()
-                        << "'. you provided object: '" <<
-            providedObjectName
-                        << "' but object is null");
-
+        _W("Object: %s should be child of: %s. you provided object: %s but object is null",
+           declaration->getName().c_str(),
+           declaration->getParentName().c_str(),
+           providedObjectName.c_str());
         return false;
     }
 
@@ -198,9 +189,9 @@ bool Explorer::register_(const JSObjectDeclarationPtr& declaration,
                          JSObjectPtr parent,
                          JSGlobalContextRef context)
 {
-    LogDebug("Registration object: " << declaration->getParentName() <<
-            "<-" << declaration->getName());
-
+    _D("Registration object: %s <- %s",
+       declaration->getParentName().c_str(),
+       declaration->getName().c_str());
     Assert(parent && "parent object is NULL");
 
     typedef JSObjectDeclaration::Options JO;
@@ -234,24 +225,24 @@ void Explorer::registerObjectIntoIframe(
     JSGlobalContextRef context)
 {
     if (declaration->getParentName() == GLOBAL_OBJECT_NAME) {
-        LogDebug("Connect to Global object of IFRAME");
+        _D("Connect to Global object of IFRAME");
         register_(declaration, frameObject, context);
         return;
     }
 
     //PIM SUPPORT
     {
-        LogWarning("Connect to NOT global object of IFRAME");
+        _D("Connect to NOT global object of IFRAME");
         //it should be master object name
         string masterName = declaration->getParentName();
         auto pos = masterName.find(".");
         if (string::npos != pos) {
-            LogError("ParentName not allowed");
+            _W("ParentName not allowed");
             return;
         }
         auto masterObject = getJSObjectProperty(masterName, frameObject);
         if (!masterObject->getObject()) {
-            LogError("Object not exist in frame");
+            _W("Object not exist in frame");
             return;
         }
         register_(declaration, masterObject, context);
@@ -260,17 +251,12 @@ void Explorer::registerObjectIntoIframe(
 
 void Explorer::loadFrame(JSGlobalContextRef context)
 {
-    LogDebug("Frame attached");
-
     JSObjectPtr frameObject =
         JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
 
-    LogDebug("Register main frame");
-    //register main frame;
-
     if (frameObject->getObject() == m_globalObject->getObject()) {
         // Main page was already loaded from constructor
-        LogDebug("Main page loaded");
+        _W("Main page loaded");
         return;
     }
 
@@ -280,38 +266,29 @@ void Explorer::loadFrame(JSGlobalContextRef context)
 
     FOREACH(object, iframeObjects)
     {
-        LogDebug("Register object: " << (*object)->getName() );
-
+        _D("Register object: %s", (*object)->getName().c_str());
         registerObjectIntoIframe(*object, frameObject, context);
     }
 }
 
 void Explorer::unloadFrame(JSGlobalContextRef context)
 {
-    LogDebug("Frame detached");
-
     JSObjectPtr frameObject =
         JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
-
     m_iframeSupport.unregisterIframe(frameObject);
 }
 
 void Explorer::removePluginsFromIframes()
 {
-    LogDebug("Remove plugins from iframes");
-
     if (m_iframeSupport.hasIframes()) {
-        LogDebug("Removing iframes");
         JavaScriptInterfaceSingleton::Instance().removeIframes(m_context);
     }
 }
 
 void Explorer::deregisterObject(const JSObjectDeclarationPtr& declaration)
 {
-    LogDebug("Deregister object " << declaration->getName());
-
     if (GLOBAL_OBJECT_NAME != declaration->getParentName()) {
-        LogWarning("Ignored remove property " << declaration->getName());
+        _W("Ignored remove property %s", declaration->getName().c_str());
         return;
     }
 
@@ -323,7 +300,6 @@ void Explorer::deregisterObject(const JSObjectDeclarationPtr& declaration)
 
 void Explorer::cleanIframesData()
 {
-    LogDebug("Clean iframes data");
     m_iframeSupport.clean();
 }
 
index 8b07ec3..5dc8f9f 100644 (file)
@@ -21,7 +21,7 @@
  *              accessing routines in EFL
  */
 #include <javascript_interface.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <dpl/scoped_array.h>
 #include <vector>
 #include <dpl/singleton_impl.h>
@@ -35,13 +35,13 @@ IMPLEMENT_SINGLETON(JavaScriptInterface)
 
 #define CHECK_JSVALUE_IS_UNDEFINED_RETURN(context, object, ret) \
     if (JSValueIsUndefined(context, object)) { \
-        LogError("Object " << #object << " is undefined"); \
+        _E("Object %s is undefined", #object); \
         return ret; \
     }
 
 #define CHECK_JSOBJECT_IS_NULL_RETURN(object, ret) \
     if (!object) { \
-        LogError("Object " << #object << " is NULL"); \
+        _E("Object %s is NULL", #object); \
         return ret; \
     }
 
@@ -59,7 +59,7 @@ std::string toString(const JSStringRef& arg)
         DPL::ScopedArray<char> buffer(new char[jsSize]);
         size_t written = JSStringGetUTF8CString(arg, buffer.Get(), jsSize);
         if (written > jsSize) {
-            LogError("Conversion could not be fully performed.");
+            _E("Conversion could not be fully performed.");
             return std::string();
         }
         result = buffer.Get();
@@ -122,7 +122,7 @@ void JavaScriptInterface::setObjectProperty(JSGlobalContextRef context,
                                             const std::string &propertyName,
                                             const JSObjectPtr& propertyObject)
 {
-    LogDebug("JSObjectSetProperty(" << context << ", \"" << propertyName << "\")");
+    _D("JSObjectSetProperty(%p, \"%s\")", context, propertyName.c_str());
 
     //create name
     JSStringRef name = JSStringCreateWithUTF8CString(propertyName.c_str());
@@ -144,7 +144,7 @@ void JavaScriptInterface::removeObjectProperty(JSGlobalContextRef context,
         //nothing to do -> no context
         return;
     }
-    LogDebug("JSObjectDeleteProperty(" << context << ", \"" << propertyName << "\")");
+    _D("JSObjectDeleteProperty(%p, \"%s\")", context, propertyName.c_str());
 
     JSStringRef name = JSStringCreateWithUTF8CString(propertyName.c_str());
     JSObjectDeleteProperty(
@@ -165,7 +165,7 @@ JavaScriptInterface::PropertiesList JavaScriptInterface::
             static_cast<JSObjectRef>(object->getObject()));
     std::size_t count = JSPropertyNameArrayGetCount(properties);
     result.reserve(count);
-    LogDebug("propesties count " << count);
+    _D("propesties count %d", count);
     for (std::size_t i = 0; i < count; ++i) {
         JSStringRef property = JSPropertyNameArrayGetNameAtIndex(properties, i);
         result.push_back(toString(property));
@@ -179,7 +179,7 @@ JSObjectPtr JavaScriptInterface::makeJSFunctionObject(
     const std::string &name,
     js_function_impl functionImplementation) const
 {
-    LogDebug("JSObjectMakeFunctionWithCallback(" << context << ", \"" << name << "\")");
+    _D("JSObjectMakeFunctionWithCallback(%p, \"%s\")", context, name.c_str());
     JSStringRef jsFunName = JSStringCreateWithUTF8CString(name.c_str());
 
     JSObjectRef object = JSObjectMakeFunctionWithCallback(
@@ -196,7 +196,7 @@ JSObjectPtr JavaScriptInterface::makeJSClassObject(
     JSGlobalContextRef context,
     JSObjectDeclaration::ConstClassTemplate classTemplate) const
 {
-    LogDebug("JSObjectMake(" << context << ")");
+    _D("JSObjectMake(%p)", context);
     JSObjectRef object = JSObjectMake(
             context,
             static_cast<JSClassRef>(
@@ -209,8 +209,7 @@ JSObjectPtr JavaScriptInterface::makeJSObjectBasedOnInterface(
     JSGlobalContextRef context,
     const std::string &interfaceName) const
 {
-    LogDebug("makeJSObjectBasedOnInterface(" << context << ", \"" << interfaceName << "\"");
-
+    _D("makeJSObjectBasedOnInterface(%p, \"%s\")", context, interfaceName.c_str());
     JSObjectPtr jsInterfaceObj = getJSObjectProperty(context,
                                                      getGlobalObject(
                                                          context),
@@ -229,7 +228,7 @@ JSObjectPtr JavaScriptInterface::makeJSInterface(
     JSObjectDeclaration::ConstClassTemplate classTemplate,
     JSObjectDeclaration::ConstructorCallback constructorCallback) const
 {
-    LogDebug("Create JS interface. Context: " << context);
+    _D("makeJSInterface(%p)", context);
     JSObjectRef object = JSObjectMakeConstructor(context,
                                                  static_cast<JSClassRef>(
                                                      const_cast<
@@ -277,12 +276,12 @@ JSObjectPtr JavaScriptInterface::createObject(
                        declaration->getConstructorCallback());
 
         default:
-            LogError("Invalid class type. Making empty JS object.");
+            _E("Invalid class type. Making empty JS object.");
             return JSObjectPtr(new JSObject(
                                    JSObjectMake(context, NULL, NULL)));
         }
     } else {
-        LogDebug("No declaration options");
+        _D("No declaration options");
         return JSObjectPtr(new JSObject(
                                JSObjectMake(
                                    context,
@@ -308,7 +307,7 @@ JSObjectPtr JavaScriptInterface::copyObjectToIframe(
     const JSObjectPtr& iframe,
     const std::string& name)
 {
-    LogError("Copy object to iframe: " << name);
+    _D("copyObjectToIframe(%s)", name.c_str());
 
     JSGlobalContextRef jsGlobalContext =
         static_cast<JSGlobalContextRef>(context);
@@ -342,10 +341,7 @@ JavaScriptInterface::ObjectsListPtr
 JavaScriptInterface::getIframesList(JSGlobalContextRef ctx) const
 {
     JSGlobalContextRef context = static_cast<JSGlobalContextRef>(ctx);
-
-    LogDebug("get global object");
     JSObjectRef globalObject = JSContextGetGlobalObject(context);
-
     ObjectsListPtr retList = getIframesList(context, globalObject);
 
     return retList;
@@ -365,7 +361,7 @@ JavaScriptInterface::getIframesList(JSContextRef context,
     CHECK_JSVALUE_IS_UNDEFINED_RETURN(context, len, ObjectsListPtr());
 
     size_t count = JSValueToNumber(context, len, NULL);
-    LogDebug("frames_o.length = " << count);
+    _D("frames_o.length = %%d", count);
 
     ObjectsListPtr retList = ObjectsListPtr(new ObjectsList());
 
@@ -376,20 +372,20 @@ JavaScriptInterface::getIframesList(JSContextRef context,
                                           frames_o,
                                           ss.str().c_str());
         if (JSValueIsUndefined(context, frame)) {
-            LogError("Selected frame is null: frame[" << i << "]");
+            _E("Selected frame is null: frame[%d]", i);
             continue;
         }
         JSObjectRef frame_obj = JSValueToObject(context, frame, NULL);
         if (!frame_obj) {
-            LogError("frame_obj is NULL.");
+            _E("frame_obj is NULL.");
             continue;
         }
         retList->push_back(JSObjectPtr(new JSObject(frame_obj)));
         ObjectsListPtr childList = getIframesList(context, frame_obj);
 
         retList->merge(*childList);
-        LogDebug("Frame Value Pointer: " << frame);
-        LogDebug("Frame Object Pointer: " << frame_obj);
+        _D("Frame Value Pointer: %p", frame);
+        _D("Frame Object Pointer: %p", frame_obj);
     }
 
     return retList;
@@ -400,12 +396,9 @@ JSObjectPtr JavaScriptInterface::getJSObjectProperty(JSGlobalContextRef ctx,
                                                      const std::string& name)
 const
 {
-    LogDebug("getJSObjectProperty(" << ctx << ", \"" << name << "\")");
-
+    _D("makeJSObjectBasedOnInterface(%p, \"%s\")", ctx, name.c_str());
     JSObjectRef frame_js = static_cast<JSObjectRef>(frame->getObject());
-
     JSValueRef property = getPropertyObj(ctx, frame_js, name.c_str());
-
     JSObjectRef objProp = JSValueToObject(ctx, property, NULL);
 
     return JSObjectPtr(new JSObject(objProp));
@@ -430,12 +423,9 @@ void JavaScriptInterface::removeIframes(JSGlobalContextRef context)
 
 void JavaScriptInterface::invokeGarbageCollector(JSGlobalContextRef context)
 {
-    LogDebug("Garbage collection #1");
+    LogDebug("Garbage collection");
     JSGarbageCollect(context);
-    LogDebug("Garbage collection #2");
     JSGarbageCollect(context);
-    LogDebug("Garbage collection #3");
     JSGarbageCollect(context);
-    LogDebug("Garbage collection #4");
     JSGarbageCollect(context);
 }
index 6c97274..cec6266 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <dpl/assert.h>
 #include <dpl/scoped_array.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <dpl/foreach.h>
 #include <dpl/singleton_impl.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
@@ -147,7 +147,7 @@ JSPageSession::Impl::Impl(const PluginContainerSupportPtr& support) :
         m_sessionStarted(false),
         m_objectExplorer(NULL)
 {
-    LogDebug("Initializing Page Session");
+    _D("Initializing Page Session");
     m_pluginsSupport = support;
 }
 
@@ -158,24 +158,24 @@ JSPageSession::Impl::~Impl()
         stopSession();
     }
 
-    LogDebug("Deinitializing plugin Logic...");
+    _D("Deinitializing Page Session");
 }
 
  void JSPageSession::Impl::installStandardFunctions()
  {
-    LogDebug("Installing standard functions...");
+    _D("========== install standard Functions START ==========");
 
     //add standard functions
     FOREACH(it, JsFunctionManagerSingleton::Instance().getFunctions()) {
         m_objectExplorer->registerObject(*it, NULL);
     }
 
-    LogDebug("Installing standard functions...[done]");
+    _D("========== install standard Functions END ==========");
  }
 
 void JSPageSession::Impl::installRootPlugins()
 {
-    LogDebug("Installing requested root plugins...");
+    _D("========== install root Functions START ==========");
 
     PluginContainerSupport::PluginsList rootPlugins =
                     m_pluginsSupport->getRootPlugins();
@@ -184,7 +184,7 @@ void JSPageSession::Impl::installRootPlugins()
         installPlugin(*it);
     }
 
-    LogDebug("Installing requested root plugins...[done]");
+    _D("========== install root Functions END ==========");
 }
 
 bool JSPageSession::Impl::installPlugin(PluginModelPtr plugin)
@@ -193,27 +193,25 @@ bool JSPageSession::Impl::installPlugin(PluginModelPtr plugin)
     PluginPtr library = loadLibrary(plugin);
 
     if (!library) {
-        LogError("Loading library failed");
+        _E("Loading library failed");
         return false;
     }
 
-    LogDebug("Install Plugin : " << library->GetFileName());
+    _D("Install Plugin : %s", library->GetFileName().c_str());
 
     // Register new class
     FOREACH(it, *(library->GetClassList()))
     {
         if (!m_objectExplorer->registerObject(*it, NULL)) {
-            LogError("Object Registration failed : " << (*it)->getName());
+            _E("Object Registration failed : %s", (*it)->getName().c_str());
         }
     }
-
-    LogDebug("Install Plugin [done]");
     return true;
 }
 
 void JSPageSession::Impl::installRequestedFeatures()
 {
-    LogDebug("Installing requested widget features...");
+    _D("========== install requested Features START ==========");
 
     std::list<std::string> allowedFeatures =
         m_pluginsSupport->getAllowedFeatures(m_widgetHandle);
@@ -222,13 +220,12 @@ void JSPageSession::Impl::installRequestedFeatures()
 
     FOREACH(feature, allowedFeatures)
     {
-        LogDebug("Processing feature: " << *feature);
+        _D("Processing feature: %s", (*feature).c_str());
 
         PluginModelPtr plugin = m_pluginsSupport->getPluginForFeature(*feature);
 
-        if (!plugin)
-        {
-            LogDebug("It didn't have plugins! : " << *feature);
+        if (!plugin) {
+            _W("It didn't have plugins! : %s", (*feature).c_str());
             continue;
         }
 
@@ -238,14 +235,13 @@ void JSPageSession::Impl::installRequestedFeatures()
 
         FOREACH(obj, implObjs)
         {
-            LogDebug("Processing object: " << *obj);
+            _D("Processing object: %s", (*obj).c_str());
             /* This can be optimalized, but would need extra data in database.
              * There should be a list of features that are allowed to be
              * installed at widget start */
             if (obj->find(".") == obj->rfind(".")) {
                 allowedPlugins.push_back(plugin);
-                LogWarning("Plugin will be added: "
-                           << plugin->LibraryName.Get());
+                _D("Plugin will be added: %s", plugin->LibraryName.Get().c_str());
                 break;
             }
         }
@@ -253,11 +249,11 @@ void JSPageSession::Impl::installRequestedFeatures()
 
     FOREACH(plugin, allowedPlugins)
     {
-        LogDebug("Installation plugin: " << (*plugin)->LibraryName.Get());
+        _D("Installation plugin: %s", (*plugin)->LibraryName.Get().c_str());
         installPlugin(*plugin);
     }
 
-    LogDebug("requested features installed.");
+    _D("========== install requested Features END ==========");
 }
 
 bool JSPageSession::Impl::loadPluginOnDemand(
@@ -265,14 +261,12 @@ bool JSPageSession::Impl::loadPluginOnDemand(
     JavaScriptObject& parentObject,
     JSGlobalContextRef context)
 {
-    LogDebug("load plugin with feature");
-
     Assert(parentObject.instance &&
            !parentObject.name.empty()
            && "Wrong arguments");
 
     if (!m_sessionStarted) {
-        LogError("Session not started");
+        _W("Session not started");
         return false;
     }
     //    //TODO here may be a bug. if plugin contains feature rejected and
@@ -304,21 +298,21 @@ bool JSPageSession::Impl::installPluginOnDemand(PluginModelPtr plugin,
     PluginPtr library = loadLibrary(plugin);
 
     if (!library) {
-        LogError("Loading library failed");
+        _E("Loading library failed");
         return false;
     }
 
-    LogDebug("Install Plugin '" << library->GetFileName());
+    _D("Install Plugin %s", library->GetFileName().c_str());
 
     if (!(parentObject.instance)) {
-        LogError("NULL pointer value");
+        _E("NULL pointer value");
         return false;
     }
 
     JSObjectPtr parent(new JSObject(parentObject.instance));
 
     if (!parent->getObject()) {
-        LogError("NULL pointer value");
+        _E("NULL pointer value");
         assert(false);
         return false;
     }
@@ -332,15 +326,14 @@ bool JSPageSession::Impl::installPluginOnDemand(PluginModelPtr plugin,
                                              context);
 
         if (!installationStatus) {
-            LogError(
-                "Object Registration failed : " << (*it)->getName()
-                                                <<
-                "; Parent object name: " << parentObject.name);
+            _E("Object Registration failed : %s; Parent object name: %s",
+               (*it)->getName().c_str(),
+               parentObject.name.c_str());
             return false;
         }
     }
 
-    LogDebug("Plugin on demand registration completed");
+    _D("Plugin on demand registration completed");
     return true;
 }
 
@@ -348,11 +341,6 @@ void JSPageSession::Impl::setCustomProperties(double scaleFactor,
                                               const char* encodedBundle,
                                               const char* theme)
 {
-    LogDebug(
-        "set properties of window object " << scaleFactor << ", "
-                                           << encodedBundle << ", " <<
-        theme);
-
     m_objectExplorer->getWindowPropertySupport()
         ->setScaleToNavigatorProperty(scaleFactor);
     m_objectExplorer->getWindowPropertySupport()
@@ -366,11 +354,9 @@ void JSPageSession::Impl::dispatchJavaScriptEvent(CustomEventType eventType,
 {
     // Check if session is already started
     if (!m_sessionStarted) {
-        LogWarning("Session not started!");
+        _W("Session not started!");
         return;
     }
-
-    LogDebug("Request dispatching javascript event");
     m_objectExplorer->callEventListeners(eventType, data);
 }
 
@@ -380,11 +366,10 @@ void JSPageSession::Impl::startSession(int widgetHandle,
                                        const char* encodedBundle,
                                        const char* theme)
 {
-    LogDebug("Starting widget session...");
 
     // Check if corresponding session if not already created
     if (m_sessionStarted) {
-        LogWarning("Session already started!");
+        _W("Session already started!");
         return;
     }
 
@@ -409,29 +394,21 @@ void JSPageSession::Impl::startSession(int widgetHandle,
 
     // set scale, bundle as window's property
     setCustomProperties(scaleFactor, encodedBundle, theme);
-
-    LogDebug("Starting widget session...[done]");
 }
 
 void JSPageSession::Impl::stopSession()
 {
-    LogDebug("Stopping widget session...");
-
     if (!m_sessionStarted) {
-        LogWarning("Session not started!");
+        _W("Session not started!");
         return;
     }
 
     unloadPluginsFromSession();
     m_sessionStarted = false;
-
-    LogDebug("Widget session stopped.");
 }
 
 void JSPageSession::Impl::unloadPluginsFromSession()
 {
-    LogDebug("Unload plugins from session");
-
     m_objectExplorer->removePluginsFromIframes();
     m_objectExplorer->cleanIframesData();
 
@@ -444,14 +421,10 @@ void JSPageSession::Impl::unloadPluginsFromSession()
     // delete js object for plugins
     FOREACH(pluginIt, m_loadedPlugins)
     {
-        LogDebug("Unregistering plugin " << (*pluginIt)->GetFileName());
-
+        _D("Unregistering plugin %s", (*pluginIt)->GetFileName().c_str());
         (*pluginIt)->OnWidgetStop(m_widgetHandle);
-        LogDebug("Emitted WidgetStop for plugin: " <<
-                 (*pluginIt)->GetFileName());
 
-        FOREACH(it, *((*pluginIt)->GetClassList()))
-        {
+        FOREACH(it, *((*pluginIt)->GetClassList())) {
             m_objectExplorer->deregisterObject(*it);
         }
     }
@@ -499,11 +472,11 @@ PluginPtr JSPageSession::Impl::loadLibrary(PluginModelPtr& pluginModel)
         pluginLib = Plugin::LoadFromFile(path);
 
         if (!pluginLib) {
-            LogError("Loading library failed");
+            _E("Loading library failed");
         } else {
             pluginModel->LibraryInstance.Set(pluginLib);
 
-            LogDebug("On widget start");
+            _D("On widget start");
             // This is first time for this plugin, start widget Session
             pluginLib->OnWidgetStart(
                 m_widgetHandle);
@@ -515,8 +488,8 @@ PluginPtr JSPageSession::Impl::loadLibrary(PluginModelPtr& pluginModel)
             }
         }
     } else {
-        LogDebug("Get from LibraryInstance");
-        LogDebug("On widget start");
+        _D("Get from LibraryInstance");
+        _D("On widget start");
         // This is first time for this plugin, start widget Session
         pluginLib->OnWidgetStart(
             m_widgetHandle);
@@ -533,10 +506,8 @@ PluginPtr JSPageSession::Impl::loadLibrary(PluginModelPtr& pluginModel)
 
 void JSPageSession::Impl::loadFrame(JSGlobalContextRef context)
 {
-    LogDebug("Load a frame");
-
     if (!m_sessionStarted) {
-        LogWarning("Session NOT started!");
+        _W("Session NOT started!");
         return;
     }
 
@@ -544,8 +515,8 @@ void JSPageSession::Impl::loadFrame(JSGlobalContextRef context)
 
     FOREACH(pluginIt, m_loadedPlugins)
     {
-        LogDebug("Try to call 'OnFrameLoad' callback : " << (*pluginIt)->GetFileName());
-
+        _D("Try to call 'OnFrameLoad' callback : %s",
+           (*pluginIt)->GetFileName().c_str());
         (*pluginIt)->OnFrameLoad(context);
     }
 
@@ -554,10 +525,8 @@ void JSPageSession::Impl::loadFrame(JSGlobalContextRef context)
 
 void JSPageSession::Impl::unloadFrame(JSGlobalContextRef context)
 {
-    LogDebug("Unload a frame");
-
     if (!m_sessionStarted) {
-        LogWarning("Session NOT started!");
+        _W("Session NOT started!");
         return;
     }
 
@@ -565,8 +534,8 @@ void JSPageSession::Impl::unloadFrame(JSGlobalContextRef context)
 
     FOREACH(pluginIt, m_loadedPlugins)
     {
-        LogDebug("Try to call 'OnFrameUnload' callback : " << (*pluginIt)->GetFileName());
-
+        _D("Try to call 'OnFrameUnload' callback : %s",
+           (*pluginIt)->GetFileName().c_str());
         (*pluginIt)->OnFrameUnload(context);
     }
 
index 27b24a5..246a548 100644 (file)
@@ -20,7 +20,7 @@
  * @brief       This file is the implementation file of plugin
  */
 #include "plugin.h"
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <dpl/assert.h>
 #include <dlfcn.h>
 
@@ -44,13 +44,13 @@ Plugin::Plugin(const std::string &fileName,
 
 Plugin::~Plugin()
 {
-    LogDebug("Unloading plugin library: " << m_fileName << "...");
+    _D("Unloading plugin library: %s", m_fileName.c_str());
 
     // Unload library
     if (dlclose(m_libHandle) != 0) {
-        LogError("Cannot close plugin handle");
+        _E("Cannot close plugin handle");
     } else {
-        LogDebug("Library is unloaded");
+        _D("Library is unloaded");
     }
 }
 
@@ -58,18 +58,18 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
 {
     static bool logEnable = (getenv("WRT_LOAD_PLUGINS_LOG_ENABLE") != NULL);
 
-    LogDebug("LoadFromFile" << fileName);
+    _D("LoadFromFile %s", fileName.c_str());
 
     void *dllHandle;
     dllHandle = dlopen(fileName.c_str(), RTLD_LAZY);
 
-    LogDebug("dlopen() done!");
+    _D("dlopen() done!");
 
     if (dllHandle == NULL) {
         const char* error = (const char*)dlerror();
-        LogError(
-            "Failed to load plugin: " << fileName <<
-            ". Reason: " << (error != NULL ? error : "unknown"));
+        _E("Failed to load plugin: %s. Reason: %s",
+           fileName.c_str(),
+           (error != NULL ? error : "unknown"));
         PluginPtr empty;
         return empty;
     }
@@ -106,34 +106,27 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
     if (getWidgetEntityMapProcPtr) {
         rawClassList = (*getWidgetEntityMapProcPtr)();
 
-        if (logEnable)
-        {
-            LogDebug(
-            "rawClassList : " << rawClassList <<
-            "by getWidgetClassMapProcPtr()");
+        if (logEnable) {
+            _D("rawClassList : %p by getWidgetClassMapProcPtr()",
+               rawClassList);
         }
     } else {
         rawClassList =
             static_cast<const js_entity_definition_t *>(dlsym(dllHandle,
                                                               PLUGIN_CLASS_MAP_NAME));
-        if (logEnable) { LogDebug("rawClassList : " << rawClassList); }
+        if (logEnable) { _D("rawClassList : %p", rawClassList); }
     }
 
     if (NULL == onWidgetStartProcPtr || NULL == onWidgetStopProcPtr ||
         /*NULL == onWidgetInitProcPtr ||*/ NULL == rawClassList)
     {
-        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("#####");
+        if (logEnable) {
+            _W("#####");
+            _W("##### Warning: The following plugin does not support new plugin API.");
+            _W("##### Old plugin API is deprecated. Please update it to new API");
+            _W("#####");
+            _W("##### Plugin: %s has got deprecated or invalid API", fileName.c_str());
+            _W("#####");
         }
 
         // Will not load plugin
@@ -143,19 +136,18 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
         return empty;
     }
 
-    if (logEnable)
-    {
-        LogDebug("#####");
-        LogDebug("##### Plugin: " << fileName << " supports new plugin API");
-        LogDebug("#####");
-        LogDebug("##### $onWidgetStartProc: " << onWidgetStartProcPtr);
-        LogDebug("##### $onWidgetInitProc: " << onWidgetInitProcPtr);
-        LogDebug("##### $onWidgetStopProc " << onWidgetStopProcPtr);
-        LogDebug("##### $onFrameLoadProc " << onFrameLoadProcPtr);
-        LogDebug("##### $onFrameUnloadProc " << onFrameUnloadProcPtr);
-        LogDebug("##### $classMap: " << reinterpret_cast<const void *>(rawClassList));
-        LogDebug("##### ");
-        LogDebug("##### Class map:");
+    if (logEnable) {
+        _D("#####");
+        _D("##### Plugin: %s supports new plugin API", fileName.c_str());
+        _D("#####");
+        _D("##### $onWidgetStartProc: %p", onWidgetStartProcPtr);
+        _D("##### $onWidgetInitProc: %p", onWidgetInitProcPtr);
+        _D("##### $onWidgetStopProc %p", onWidgetStopProcPtr);
+        _D("##### $onFrameLoadProc %p", onFrameLoadProcPtr);
+        _D("##### $onFrameUnloadProc %p", onFrameUnloadProcPtr);
+        _D("##### $classMap: %p", reinterpret_cast<const void *>(rawClassList));
+        _D("##### ");
+        _D("##### Class map:");
     }
 
     const js_entity_definition_t *rawEntityListIterator = rawClassList;
@@ -168,11 +160,10 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
         if (logEnable)
         {
             // Logging
-            LogDebug("#####");
-            LogDebug("#####     [" << rawEntityListIterator->object_name << "]: ");
-            LogDebug("#####     Interface: " <<
-                    rawEntityListIterator->interface_name);
-            LogDebug("#####     Parent: " << rawEntityListIterator->parent_name);
+            _D("#####");
+            _D("##### [%s]", rawEntityListIterator->object_name);
+            _D("##### Interface: %s", rawEntityListIterator->interface_name);
+            _D("##### Parent: %s", rawEntityListIterator->parent_name);
         }
 
         // Register class
@@ -183,7 +174,7 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName)
     }
 
     // Load export table
-    LogDebug("Plugin successfuly loaded");
+    _D("Plugin successfuly loaded");
 
     // Insert to loaded modules list
 
@@ -208,7 +199,7 @@ void Plugin::OnWidgetStart(int widgetId)
 {
     if (NULL != m_apiOnWidgetStart) {
         (*m_apiOnWidgetStart)(widgetId);
-        LogDebug("Called!");
+        _D("Called!");
     }
 }
 
@@ -217,7 +208,7 @@ void Plugin::OnWidgetInit(feature_mapping_interface_t* mapping)
     Assert(NULL != mapping && "NULL mapping interface provided");
     if (NULL != m_apiOnWidgetInit) {
         (*m_apiOnWidgetInit)(mapping);
-        LogDebug("Called!");
+        _D("Called!");
     }
 }
 
@@ -225,7 +216,7 @@ void Plugin::OnWidgetStop(int widgetId)
 {
     if (NULL != m_apiOnWidgetStop) {
         (*m_apiOnWidgetStop)(widgetId);
-        LogDebug("Called!");
+        _D("Called!");
     }
 }
 
@@ -233,7 +224,7 @@ void Plugin::OnFrameLoad(java_script_context_t context)
 {
     if (NULL != m_apiOnFrameLoad) {
         (*m_apiOnFrameLoad)(context);
-        LogDebug("Called!");
+        _D("Called!");
     }
 }
 
@@ -241,7 +232,7 @@ void Plugin::OnFrameUnload(java_script_context_t context)
 {
     if (NULL != m_apiOnFrameUnload) {
         (*m_apiOnFrameUnload)(context);
-        LogDebug("Called!");
+        _D("Called!");
     }
 }
 
index 0fb1edd..1a8868f 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <fstream>
 
+#include <dpl/log/secure_log.h>
 #include <dpl/foreach.h>
 #include <dpl/wrt-dao-ro/feature_dao_read_only.h>
 #include <dpl/wrt-dao-ro/global_config.h>
@@ -63,10 +64,10 @@ std::list<std::string> PluginContainerSupport::getAllowedFeatures(
 
     std::list<std::string> allowedFeatures;
     FOREACH(it, features) {
-        LogDebug("Loading api-feature: " << it->name);
+        _D("Loading api-feature: %s", DPL::ToUTF8String(it->name).c_str());
         if (it->rejected) {
-            LogWarning("Api-feature was rejected by ace. (Api-feature name: "
-                       << it->name << ")");
+            _W("Api-feature was rejected by ace. (Api-feature name: %s)",
+               it->name.c_str());
             continue;
         }
 
@@ -106,11 +107,11 @@ void PluginContainerSupport::readRootPlugins(int widgetHandle)
     if (appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
          FOREACH(it_rootPluginHandle, m_rootPluginsList)
         {
-            LogDebug("*it_rootPluginHandle: " << *it_rootPluginHandle);
+            _D("*it_rootPluginHandle: %d", *it_rootPluginHandle);
             registerPluginModel(*it_rootPluginHandle);
         }
     } else {
-        LogDebug("Not defined app type");
+        _D("Not defined app type");
     }
     m_initialized = true;
 }
@@ -121,14 +122,13 @@ void PluginContainerSupport::registerFeatureModel(
     DeviceCapList
     deviceCapabilities)
 {
-    LogDebug("Analyzing feature: " << handle);
     FeatureModelPtr model = getFeatureModel(handle);
     if (model) {
-        LogDebug("Model for feature:" << handle << " already created");
+        _D("Model for feature: %d already created", handle);
         return;
     }
 
-    LogDebug("Creating Model for feature:" << handle);
+    _D("Creating Model for feature: %d", handle);
 
     model.reset(new FeatureModel(handle));
 
@@ -146,31 +146,29 @@ void PluginContainerSupport::registerPluginModel(DbPluginHandle handle)
     PluginModelPtr model = getPluginModelById(handle);
 
     if (model) {
-        LogDebug("Model for plugin:" << handle << " already registered");
+        _D("Model for plugin: %d already registered", handle);
         return;
     }
 
-    LogDebug("Creating Model for plugin: " << handle);
-
     if (PluginDAOReadOnly::INSTALLATION_COMPLETED !=
         PluginDAOReadOnly::getInstallationStateForHandle(handle))
     {
-        LogWarning("Failed To CreateModel for handle " << handle);
+        _W("Failed To CreateModel for handle %d", handle);
         return;
     }
 
     model.Reset(new PluginModel(handle));
 
-    LogDebug("Model Created. Handle: " <<
-            handle << ", name: " << model->LibraryName.Get());
+    \r_D("Model Created. Handle: %d, name: %s",
+       handle,
+       model->LibraryName.Get().c_str());
 
     m_pluginModels.insert(model);
 }
 
 void PluginContainerSupport::readRootPluginsList()
 {
-    LogDebug("Reading root plugins list from so files...");
-
+    _D("Reading root plugins list from so files...");
     m_rootPluginsList = PluginDAOReadOnly::getRootPluginHandleList();
 }
 
@@ -216,14 +214,11 @@ PluginContainerSupport::getPluginModelById(DbPluginHandle handle) const
 PluginModelPtr
 PluginContainerSupport::getPluginModel(const FeatureModelPtr &feature) const
 {
-    if (!feature)
-    {
-        LogDebug("Null Ptr for feature model");
+    if (!feature) {
+        _D("Null Ptr for feature model");
         return PluginModelPtr();
-    }
-    else
-    {
-        LogDebug("Feature located in plugin: " << feature->PHandle.Get());
+    } else {
+        _D("Feature located in plugin: %d", feature->PHandle.Get());
         return getPluginModelById(feature->PHandle.Get());
     }
 }
@@ -233,11 +228,10 @@ PluginContainerSupport::getRootPlugins() const
 {
     PluginsList plugins;
 
-    FOREACH(it, m_rootPluginsList)
-    {
+    FOREACH(it, m_rootPluginsList) {
         PluginModelPtr plugin = getPluginModelById(*it);
         if (!plugin) {
-            LogError("PluginModel not found");
+            _W("PluginModel not found");
             continue;
         }
 
@@ -250,12 +244,9 @@ PluginContainerSupport::getRootPlugins() const
 PluginContainerSupport::PluginsList
 PluginContainerSupport::getPluginsList() const
 {
-    LogDebug("");
-
     PluginsList plugins;
 
-    FOREACH(it, m_pluginModels)
-    {
+    FOREACH(it, m_pluginModels) {
         plugins.push_back(*it);
     }
 
index 2e1c8c6..4e428dd 100644 (file)
 
 #include <algorithm>
 #include <dpl/foreach.h>
+#include <dpl/log/secure_log.h>
 
 void IframesSupport::registerDeclaration(
     const JSObjectDeclarationPtr& declaration)
 {
-    LogDebug("Registration iframes-supported plugins " <<
-             declaration->getName());
+    _D("Registration iframes-supported plugins %s", declaration->getName().c_str());
 
     if (declaration->getParentName().find('.') != std::string::npos) {
-        LogWarning("The object will not be loaded to iframes");
+        _E("The object will not be loaded to iframes");
         return;
     }
     m_iframesObjects.push_back(declaration);
@@ -39,21 +39,21 @@ void IframesSupport::registerDeclaration(
 
 void IframesSupport::registerIframe(const JSObjectPtr& iframe)
 {
-    LogDebug("LoadedIframes size: " << m_loadedIframes.size() );
+    _D("LoadedIframes size: %d", m_loadedIframes.size() );
 
     m_loadedIframes.insert(iframe);
 }
 
 void IframesSupport::unregisterIframe(const JSObjectPtr& iframe)
 {
-    LogDebug("LoadedIframes size: " << m_loadedIframes.size() );
+    _D("LoadedIframes size: %d", m_loadedIframes.size() );
 
     auto it_loaded = std::find_if(m_loadedIframes.begin(),
                                   m_loadedIframes.end(),
                                   std::bind2nd(EqualToJSObjectPtr(), iframe));
     //object not found, so thats the new iframe
     if (it_loaded == m_loadedIframes.end()) {
-        LogDebug("Nothing to unregister");
+        _D("Nothing to unregister");
         return;
     }
 
index c91f309..d3df0da 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <dpl/assert.h>
 #include <dpl/scoped_array.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <dpl/foreach.h>
 #include <dpl/singleton_impl.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
@@ -122,7 +122,7 @@ bool PluginLogic::Impl::s_sanityCheck = false;
 #define PLUGIN_LOGIC_SANITY_CHECK \
     if (!s_sanityCheck) \
     { \
-        LogError("Object is not available. Wrong flow occured"); \
+        _E("Object is not available. Wrong flow occured"); \
         return; \
     }
 
@@ -132,7 +132,7 @@ PluginLogic::Impl::Impl() :
     s_sanityCheck = true;
 
     DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS");
-    LogDebug("Initializing Plugin Logic...");
+    _D("Initializing Plugin Logic...");
     m_pluginsSupport = PluginContainerSupportPtr(new PluginContainerSupport());
 
     // explicit call to keep singleton's lifetime until calling destructor.
@@ -142,17 +142,15 @@ PluginLogic::Impl::Impl() :
 
 PluginLogic::Impl::~Impl()
 {
-    LogDebug("");
+    _D("called");
 
     s_sanityCheck = false;
 
     FOREACH(it, m_sessions)
     {
-        LogError("Must stop widget session before exit!");
+        _W("Must stop widget session before exit!");
         it->second->stopSession();
     }
-
-    LogDebug("Deinitializing plugin Logic...");
 }
 
 void PluginLogic::initSession(int widgetHandle)
@@ -176,7 +174,7 @@ void PluginLogic::stopSession(JSGlobalContextRef context)
 
 void PluginLogic::performLibrariesUnload()
 {
-    LogError("Libraries unload TURNED OFF");
+    _W("This function is DEPRECATED");
     //    m_impl->performLibrariesUnload();
 }
 
@@ -190,14 +188,14 @@ bool PluginLogic::loadPluginOnDemand(
 
 void PluginLogic::loadPluginsIntoIframes(JSGlobalContextRef /*context*/)
 {
-    LogError("This function is Deprecated");
+    _W("This function is DEPRECATED");
 }
 
 void PluginLogic::setCustomProperties(double /*scaleFactor*/,
                                       const char* /*encodedBundle*/,
                                       const char* /*theme*/)
 {
-    LogError("This function is DEPRECATED");
+    _W("This function is DEPRECATED");
 }
 
 void PluginLogic::setCustomProperties(JSGlobalContextRef context,
@@ -210,7 +208,7 @@ void PluginLogic::setCustomProperties(JSGlobalContextRef context,
 
 void PluginLogic::dispatchJavaScriptEvent(CustomEventType /*eventType*/)
 {
-    LogError("This function is DEPRECATED");
+    _W("This function is DEPRECATED");
 }
 
 void PluginLogic::dispatchJavaScriptEvent(JSGlobalContextRef context,
@@ -248,13 +246,9 @@ PluginLogic::~PluginLogic()
 
 void PluginLogic::Impl::initSession(int widgetHandle)
 {
-    LogDebug("init pluginLogic...");
+    _D(">---------------------[init session START]---------------------<");
 
     m_pluginsSupport->Initialize(widgetHandle);
-
-    //add standard objects
-    LogDebug("Preload plugins so file");
-
     PluginContainerSupport::PluginsList rootPluginList =
         m_pluginsSupport->getRootPlugins();
 
@@ -271,20 +265,17 @@ void PluginLogic::Impl::initSession(int widgetHandle)
             pluginLib = Plugin::LoadFromFile(path);
 
             if (!pluginLib) {
-                LogError("Loading library failed");
+                _W("Loading library failed");
             } else {
                 pluginModel->LibraryInstance.Set(pluginLib);
-
-                LogDebug(
-                    "pluginModel->LibraryInstance.Set() : " <<
-                    pluginLib->GetFileName());
+                _D("pluginModel->LibraryInstance.Set() : %s",
+                   pluginLib->GetFileName().c_str());
             }
         } else {
-            LogDebug("Already loaded");
+            _D("Already loaded");
         }
     }
-
-    LogDebug("Preload plugins so file_done");
+    _D("========== init session END ==========");
 }
 
 void PluginLogic::Impl::startSession(int widgetHandle,
@@ -293,7 +284,7 @@ void PluginLogic::Impl::startSession(int widgetHandle,
                                      const char* encodedBundle,
                                      const char* theme)
 {
-    LogDebug("Starting widget session...");
+    _D("========== start session START ==========");
 
     if (!m_pluginsSupport->isInitialized()) {
         m_pluginsSupport->Initialize(widgetHandle);
@@ -302,34 +293,32 @@ void PluginLogic::Impl::startSession(int widgetHandle,
 
     // Check if corresponding session if not already created
     if (sessionIt != m_sessions.end()) {
-        LogWarning("Session already started!");
-        return;
+        _W("Session already started!");
+    } else {
+        auto newSession = JSPageSessionPtr(new JSPageSession(m_pluginsSupport));
+        newSession->startSession(widgetHandle,
+                                 context,
+                                 scaleFactor,
+                                 encodedBundle,
+                                 theme);
+
+        m_sessions[context] = newSession;
     }
-
-    auto newSession = JSPageSessionPtr(new JSPageSession(m_pluginsSupport));
-    newSession->startSession(widgetHandle,
-                             context,
-                             scaleFactor,
-                             encodedBundle,
-                             theme);
-
-    m_sessions[context] = newSession;
+    _D("========== start session END ==========");
 }
 
 void PluginLogic::Impl::stopSession(JSGlobalContextRef context)
 {
-    LogDebug("Stopping widget session...");
+    _D("========== stop session START ==========");
 
     auto sessionIt = m_sessions.find(context);
     if (sessionIt == m_sessions.end()) {
-        LogError("Session not exist!");
-        return;
+        _W("Session not exist!");
+    } else {
+        sessionIt->second->stopSession();
+        m_sessions.erase(sessionIt);
     }
-
-    sessionIt->second->stopSession();
-    m_sessions.erase(sessionIt);
-
-    LogDebug("Widget session stopped.");
+    _D("========== stop session END ==========");
 }
 
 bool PluginLogic::Impl::loadPluginOnDemand(
@@ -338,11 +327,11 @@ bool PluginLogic::Impl::loadPluginOnDemand(
     JSGlobalContextRef context
     )
 {
-    LogDebug("Load plugin on demand");
+    _D("========== load ondemand plugin ==========");
 
     auto sessionIt = m_sessions.find(context);
     if (sessionIt == m_sessions.end()) {
-        LogWarning("Session not exist!");
+        _W("Session not exist!");
         return false;
     }
 
@@ -353,36 +342,34 @@ bool PluginLogic::Impl::loadPluginOnDemand(
 
 void PluginLogic::Impl::loadFrame(JSGlobalContextRef context)
 {
-    LogDebug("Load a frame");
-
+    _D("========== load frame START ==========");
     PLUGIN_LOGIC_SANITY_CHECK
 
     auto sessionIt = m_sessions.find(context);
     if (sessionIt == m_sessions.end()) {
-        LogWarning("Session not exist!");
-        return;
+        _W("Session not exist!");
+    } else {
+        sessionIt->second->loadFrame(context);
     }
-
-    sessionIt->second->loadFrame(context);
+    _D("========== load frame END ==========");
 }
 
 void PluginLogic::Impl::unloadFrame(JSGlobalContextRef context)
 {
-    LogDebug("Unload a frame");
-
+    _D("========== unload frame START ==========");
     PLUGIN_LOGIC_SANITY_CHECK
 
     auto sessionIt = m_sessions.find(context);
     if (sessionIt == m_sessions.end()) {
         LogWarning("Session not exist!");
-        return;
-    }
-
-    sessionIt->second->unloadFrame(context);
+    } else {
+        sessionIt->second->unloadFrame(context);
 
-    // I don't know why this session should be removed here.
-    // session list is removed also from stopSession().
-    //m_sessions.erase(sessionIt);
+        // I don't know why this session should be removed here.
+        // session list is removed also from stopSession().
+        //m_sessions.erase(sessionIt);
+        }
+    _D("========== unload frame END ==========");
 }
 
 void PluginLogic::Impl::setCustomProperties(JSGlobalContextRef context,
@@ -390,16 +377,11 @@ void PluginLogic::Impl::setCustomProperties(JSGlobalContextRef context,
                                             const char* encodedBundle,
                                             const char* theme)
 {
-    LogDebug(
-        "set properties of window object " << scaleFactor << ", "
-                                           << encodedBundle << ", " <<
-        theme);
-
     PLUGIN_LOGIC_SANITY_CHECK
 
     auto sessionIt = m_sessions.find(context);
     if (sessionIt == m_sessions.end()) {
-        LogWarning("Session not exist!");
+        _W("Session not exist!");
         return;
     }
 
@@ -412,13 +394,11 @@ void PluginLogic::Impl::dispatchJavaScriptEvent(JSGlobalContextRef context,
                                                 CustomEventType eventType,
                                                 void* data)
 {
-    LogDebug("Dispatch event");
-
     PLUGIN_LOGIC_SANITY_CHECK
 
     auto sessionIt = m_sessions.find(context);
     if (sessionIt == m_sessions.end()) {
-        LogWarning("Session not exist!");
+        _W("Session not exist!");
         return;
     }
 
@@ -427,8 +407,7 @@ void PluginLogic::Impl::dispatchJavaScriptEvent(JSGlobalContextRef context,
 
 unsigned int PluginLogic::Impl::windowHandle() const
 {
-    if (!s_sanityCheck)
-    {
+    if (!s_sanityCheck) {
         LogError("Object is not available. Wrong flow occured");
     }
     return m_windowHandle;
@@ -437,6 +416,5 @@ unsigned int PluginLogic::Impl::windowHandle() const
 void PluginLogic::Impl::setWindowHandle(unsigned int handle)
 {
     PLUGIN_LOGIC_SANITY_CHECK
-    LogDebug("XWindow handle " << handle);
     m_windowHandle = handle;
 }
index e1731cd..7569de2 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #include "plugin_property_support.h"
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 
 using namespace PluginModule;
 
@@ -63,42 +63,32 @@ JSGlobalContextRef WindowPropertySupport::getJSContext() const
 
 void WindowPropertySupport::setScaleToNavigatorProperty(const double scale)
 {
-    LogDebug("set window.navigator.scale: " << scale);
-
+    _D("set window.navigator.scale: %ld", scale);
     m_scale = scale;
-
     setPropertyToNavigator(SCALE_PROPERTY_NAME,
                            JSValueMakeNumber(m_context, scale));
 }
 
 void WindowPropertySupport::setBundleToWindowProperty(const char* bundle)
 {
-    LogDebug("set window.__bundle: " << bundle);
-
+    _D("set window.__bundle: %s", bundle);
     if (bundle) {
         m_bundle = bundle;
-
         JSStringRef bundleString = JSStringCreateWithUTF8CString(bundle);
-
         setPropertyToWindow(BUNDLE_PROPERTY_NAME,
                             JSValueMakeString(m_context, bundleString));
-
         JSStringRelease(bundleString);
     }
 }
 
 void WindowPropertySupport::setThemeToNavigatorProperty(const char* theme)
 {
-    LogDebug("set window.navigator.__theme: " << theme);
-
+    _D("set window.navigator.__theme: %s", theme);
     if (theme) {
         m_theme = theme;
-
         JSStringRef themeString = JSStringCreateWithUTF8CString(theme);
-
         setPropertyToNavigator(THEME_PROPERTY_NAME,
                                JSValueMakeString(m_context, themeString));
-
         JSStringRelease(themeString);
     }
 }
@@ -106,9 +96,9 @@ void WindowPropertySupport::setThemeToNavigatorProperty(const char* theme)
 void WindowPropertySupport::setPropertyToWindow(const char* propertyName,
                                                 JSValueRef jsValue)
 {
+    _D("et property to window : %s", propertyName);
     if (propertyName) {
         JSObjectRef globalObject = JSContextGetGlobalObject(m_context);
-
         JSStringRef propertyNameString =
             JSStringCreateWithUTF8CString(propertyName);
         JSObjectSetProperty(m_context,
@@ -117,7 +107,6 @@ void WindowPropertySupport::setPropertyToWindow(const char* propertyName,
                             jsValue,
                             kJSPropertyAttributeReadOnly,
                             NULL);
-
         JSStringRelease(propertyNameString);
     }
 }
@@ -125,6 +114,7 @@ void WindowPropertySupport::setPropertyToWindow(const char* propertyName,
 void WindowPropertySupport::setPropertyToNavigator(const char* propertyName,
                                                    JSValueRef jsValue)
 {
+    _D("set property to navigator : %s", propertyName);
     if (propertyName) {
         JSObjectRef globalObject = JSContextGetGlobalObject(m_context);
 
index 547efae..d848d26 100644 (file)
@@ -26,7 +26,7 @@
 #include <WKBundle.h>
 #include <WKString.h>
 #include <WKType.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <dpl/assert.h>
 
 static WKBundleRef s_injectedBundleRef = NULL;
@@ -163,13 +163,13 @@ AsyncConnectionPtr AsyncConnectionManager::getConnection(int handle)
 
 void IPCMessageSupport::setWKBundleRef(WKBundleRef bundleRef)
 {
-    LogDebug("setWKBundleRef called");
+    _D("called");
     s_injectedBundleRef = bundleRef;
 }
 
 void IPCMessageSupport::setXwindowHandle(unsigned int handle)
 {
-    LogDebug("setXwindowHandle called");
+    _D("called");
     s_xWindowHandle = handle;
 }
 
@@ -177,14 +177,14 @@ const char* IPCMessageSupport::sendMessageToUiProcess(
     const char* name,
     const char* body)
 {
-    LogDebug("sendMessageToUiProcess called");
+    _D("called");
     if (s_injectedBundleRef == NULL) {
-        LogError("UI Process information isn't set");
+        _E("UI Process information isn't set");
         return NULL;
     }
-    LogDebug("name = [" << name << "]");
+    _D("name = [%s]", name);
     if (body) {
-        LogDebug("body = [" << body << "]");
+        _D("body = [%s]", body);
     }
 
     if (!name) {
@@ -214,17 +214,17 @@ const char* IPCMessageSupport::sendMessageToUiProcess(
 
 int IPCMessageSupport::sendAsyncMessageToUiProcess(const char* name, const char* body, AsyncReplyCallback replyCallback, void* data)
 {
-    LogDebug("sendAsyncMessageToUiProcess called");
+    _D("called");
 
     if (s_injectedBundleRef == NULL)
     {
-        LogError("UI Process information isn't set");
+        _E("UI Process information isn't set");
         return -1;
     }
 
     if (name == NULL)
     {
-        LogError("msg name is null!");
+        _E("msg name is null!");
         return -1;
     }
 
@@ -233,15 +233,17 @@ int IPCMessageSupport::sendAsyncMessageToUiProcess(const char* name, const char*
         body = "";
     }
 
-    LogDebug("name = [" << name << "]");
-    LogDebug("body = [" << body << "]");
+    _D("name = [%s]", name);
+    if (!body) {
+        _D("body = [%s]", body);
+    }
 
     return sendAsyncMessage(name, body, replyCallback, data);
 }
 
 void* IPCMessageSupport::ignoreAsyncMessageReply(int handle)
 {
-    LogDebug("ignoreAsyncMessageReply called");
+    _D("called");
 
     AsyncConnectionPtr connection = AsyncConnectionManager::instance().getConnection(handle);
 
@@ -257,7 +259,7 @@ void* IPCMessageSupport::ignoreAsyncMessageReply(int handle)
 
 void IPCMessageSupport::replyAsyncMessageToWebProcess(Ewk_Context* ewkContext, int handle, const char* body)
 {
-    LogDebug("replyAsyncMessageToWebProcess called");
+    _D("called");
 
     if (ewkContext == NULL)
     {
index fe0174f..a76454d 100644 (file)
@@ -12,6 +12,9 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #
+
+ADD_DEFINITIONS("-DWRT_PLUGINS_WIDGET_LOG")
+
 set(TARGET_NAME "wrt-plugins-w3c-widget-interface")
 
 pkg_search_module(webkit2 REQUIRED ewebkit2)
index d3ba880..1b3785b 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <string>
 #include <dpl/assert.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 #include <dpl/optional.h>
 #include <CommonsJavaScript/Converter.h>
 #include <CommonsJavaScript/JSDOMExceptionFactory.h>
@@ -47,49 +47,49 @@ using namespace WrtDeviceApis::StorageEvent::Api;
 
 #define CATCH_EXCEPTION_NO_MODIFABLE \
     Catch(Commons::LocalStorageValueNoModifableException) { \
-        LogError("The item is read only"); \
+        _E("The item is read only"); \
         return JSDOMExceptionFactory:: \
                    NoModificationAllowedException.make(context, exception); \
     }
 
 #define CATCH_EXCEPTION_CONVERSION \
     Catch(Commons::ConversionException) { \
-        LogError("Error on conversion"); \
+        _E("Error on conversion"); \
         return JSDOMExceptionFactory:: \
                    UnknownException.make(context, exception); \
     }
 
 #define CATCH_EXCEPTION_NULL_PTR \
     Catch(Commons::NullPointerException) { \
-        LogError("Error on pointer, null value"); \
+        _E("Error on pointer, null value"); \
         return JSDOMExceptionFactory:: \
                    UnknownException.make(context, exception); \
     }
 
 #define CATCH_EXCEPTION_PLATFORM_ERROR \
     Catch(Commons::PlatformException){ \
-        LogError("PlatformException occured"); \
+        _E("PlatformException occured"); \
         return JSDOMExceptionFactory:: \
                    UnknownException.make(context, exception); \
     }
 
 #define CATCH_EXCEPTION_SECURITY \
     Catch(Commons::SecurityException){ \
-        LogError("Security exception occured"); \
+        _E("Security exception occured"); \
         return JSDOMExceptionFactory:: \
                    SecurityException.make(context, exception); \
     }
 
 #define CATCH_EXCEPTION_OUT_OF_RANGE \
     Catch(Commons::OutOfRangeException) { \
-        LogError("OutOfRangeException"); \
+        _E("OutOfRangeException"); \
         return JSDOMExceptionFactory:: \
                    QuotaExceededException.make(context, exception); \
     }
 
 #define CATCH_EXCEPTION_INVALID_ARG \
     Catch(Commons::InvalidArgumentException) { \
-        LogError("Pair for given key doesnt exist"); \
+        _E("Pair for given key doesnt exist"); \
         return JSValueMakeNull(context); \
     }
 
@@ -97,13 +97,12 @@ namespace WrtPlugins {
 namespace W3C {
 ILocalStoragePtr getIStorage(JSObjectRef arg)
 {
-    LogWarning("get localstorage object");
-
+    _D("get localstorage object");
     LocalStoragePrivateData* priv =
         static_cast<LocalStoragePrivateData*>(JSObjectGetPrivate(arg));
 
     if (!priv) {
-        LogError("Private object not initialized");
+        _E("Private object not initialized");
         ThrowMsg(Commons::NullPointerException,
                  "Private object not initialized");
     }
@@ -113,13 +112,12 @@ ILocalStoragePtr getIStorage(JSObjectRef arg)
 
 JSObjectRef getWidgetObject(JSObjectRef arg)
 {
-    LogWarning("get widget object");
-
+    _D("get widget object");
     LocalStoragePrivateData* priv =
         static_cast<LocalStoragePrivateData*>(JSObjectGetPrivate(arg));
 
     if (!priv) {
-        LogError("Private object not initialized");
+        _E("Private object not initialized");
         ThrowMsg(Commons::NullPointerException,
                  "Private object not initialized");
     }
@@ -226,7 +224,7 @@ JSClassRef JSPreferences::m_jsClassRef =
 void JSPreferences::initialize(JSContextRef context,
                                JSObjectRef object)
 {
-    LogDebug("entered. Context: " << context);
+    _D("entered. Context: %p", context);
 
     LocalStoragePrivateData* priv =
         static_cast<LocalStoragePrivateData*>(JSObjectGetPrivate(object));
@@ -236,12 +234,11 @@ void JSPreferences::initialize(JSContextRef context,
 
 void JSPreferences::finalize(JSObjectRef object)
 {
-    LogDebug("entered");
+    _D("entered");
     LocalStoragePrivateData* priv =
         static_cast<LocalStoragePrivateData*>(JSObjectGetPrivate(object));
 
     delete priv;
-    LogDebug("private object is realised");
 }
 
 JSValueRef JSPreferences::removeItem(JSContextRef context,
@@ -251,7 +248,7 @@ JSValueRef JSPreferences::removeItem(JSContextRef context,
                                      const JSValueRef arguments[],
                                      JSValueRef* exception)
 {
-    LogDebug("entered");
+    _D("entered");
 
     Try {
         Converter converter(context);
@@ -266,7 +263,6 @@ JSValueRef JSPreferences::removeItem(JSContextRef context,
 
         DispatchEventSupport::dispatchStorageEvent(g_context, key, oldValue, newValue, "");
 
-        LogDebug("end");
         return JSValueMakeNull(context);
     }
     CATCH_EXCEPTION_NO_MODIFABLE
@@ -277,15 +273,13 @@ JSValueRef JSPreferences::removeItem(JSContextRef context,
 }
 
 JSValueRef JSPreferences::setItem(JSContextRef context,
-                                  JSObjectRef object,
+                                  JSObjectRef /*object*/,
                                   JSObjectRef thisObject,
                                   size_t /*argumentCount*/,
                                   const JSValueRef arguments[],
                                   JSValueRef* exception)
 {
-    LogDebug("entered");
-    LogDebug("This: " << thisObject);
-    LogDebug("Object: " << object);
+    _D("entered");
 
     Try {
         Converter converter(context);
@@ -301,8 +295,6 @@ JSValueRef JSPreferences::setItem(JSContextRef context,
 
         DispatchEventSupport::dispatchStorageEvent(g_context, key, oldValue, newValue, "");
 
-        LogDebug("end");
-
         return JSValueMakeUndefined(context);
     }
     CATCH_EXCEPTION_NO_MODIFABLE
@@ -320,7 +312,7 @@ JSValueRef JSPreferences::clear(JSContextRef context,
                                 const JSValueRef /*arguments*/[],
                                 JSValueRef* exception)
 {
-    LogDebug("entered");
+    _D("entered");
 
     Try {
         getIStorage(thisObject)->clear(false);
@@ -331,8 +323,6 @@ JSValueRef JSPreferences::clear(JSContextRef context,
 
         DispatchEventSupport::dispatchStorageEvent(g_context, null, null, null, "");
 
-        LogDebug("end");
-
         return JSValueMakeNull(context);
     }
     CATCH_EXCEPTION_NULL_PTR
@@ -347,14 +337,14 @@ JSValueRef JSPreferences::getItem(JSContextRef context,
                                   const JSValueRef arguments[],
                                   JSValueRef* exception)
 {
-    LogDebug("entered");
+    _D("entered");
 
     Try {
         Converter converter(context);
 
         std::string key = converter.tryString(arguments[0]);
 
-        LogDebug("Getting item for key " << key);
+        _D("Getting item for key %s", key.c_str());
 
         DPL::Optional<std::string> value =
             getIStorage(thisObject)->getValue(key);
@@ -379,11 +369,11 @@ JSValueRef JSPreferences::key(JSContextRef context,
                               const JSValueRef arguments[],
                               JSValueRef* exception)
 {
-    LogDebug("entered");
+    _D("entered");
 
     Try {
         if (argumentCount < 1) {
-            LogError("No argument found");
+            _E("No argument found");
             Throw(Commons::InvalidArgumentException);
         }
 
@@ -393,8 +383,6 @@ JSValueRef JSPreferences::key(JSContextRef context,
 
         std::string value = getIStorage(thisObject)->getKeyByIndex(n);
 
-        LogDebug("end");
-
         return converter.toJSValueRef(value);
     }
     CATCH_EXCEPTION_CONVERSION
@@ -409,7 +397,7 @@ JSValueRef JSPreferences::getLength(JSContextRef context,
                                     JSStringRef /*propertyName*/,
                                     JSValueRef* exception)
 {
-    LogDebug("enter");
+    _D("enter");
 
     Try
     {
@@ -429,7 +417,7 @@ bool JSPreferences::hasProperty(JSContextRef context,
                                 JSObjectRef object,
                                 JSStringRef propertyName)
 {
-    LogDebug("enter");
+    _D("enter");
 
     Try {
         Converter converter(context);
@@ -444,19 +432,19 @@ bool JSPreferences::hasProperty(JSContextRef context,
     }
 
     Catch(Commons::InvalidArgumentException) {
-        LogDebug("Pair for given key doesnt exist");
+        _E("Pair for given key doesnt exist");
     }
 
     Catch(Commons::ConversionException) {
-        LogError("Error on conversion");
+        _E("Error on conversion");
     }
 
     Catch(Commons::NullPointerException) {
-        LogError("Error on pointer, null value");
+        _E("Error on pointer, null value");
     }
 
     Catch(Commons::PlatformException){
-        LogError("PlatformException occured");
+        _E("PlatformException occured");
     }
     return false;
 }
@@ -466,7 +454,7 @@ JSValueRef JSPreferences::getProperty(JSContextRef context,
                                       JSStringRef propertyName,
                                       JSValueRef* exception)
 {
-    LogDebug("enter");
+    _D("enter");
 
     Try {
         Converter converter(context);
@@ -476,8 +464,6 @@ JSValueRef JSPreferences::getProperty(JSContextRef context,
         DPL::Optional<std::string> value =
             getIStorage(object)->getValue(key);
 
-        LogDebug("end");
-
         if (!value) {
             return JSValueMakeNull(context);
         } else {
@@ -497,7 +483,7 @@ bool JSPreferences::setProperty(JSContextRef context,
                                 JSValueRef jvalue,
                                 JSValueRef* exception)
 {
-    LogDebug("enter");
+    _D("enter");
 
     Try {
         Converter converter(context);
@@ -518,8 +504,6 @@ bool JSPreferences::setProperty(JSContextRef context,
 
         DispatchEventSupport::dispatchStorageEvent(g_context, key, oldValueStr, newValueStr, "");
 
-        LogDebug("end");
-
         return true;
     }
     CATCH_EXCEPTION_NO_MODIFABLE
index 10cdea6..1768069 100644 (file)
@@ -21,7 +21,7 @@
  * @brief
  */
 
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
 
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
@@ -63,14 +63,14 @@ class_definition_options_t WidgetInterfaceOptions = {
 
 void on_widget_init_callback(feature_mapping_interface_t *mapping)
 {
-    LogDebug("[W3C\\widget] on_widget_init_callback");
+    _D("[W3C\\widget] on_widget_init_callback");
 
     WrtPlugins::W3C::WidgetDeclarations::getMappingInterface(mapping);
 }
 
 void on_widget_start_callback(int widgetId)
 {
-    LogDebug("[W3C\\widget] on_widget_start_callback (" << widgetId << ")");
+    _D("[W3C\\widget] on_widget_start_callback (%d)", widgetId);
 
     Try
     {
@@ -78,21 +78,21 @@ void on_widget_start_callback(int widgetId)
     }
     Catch(Commons::Exception)
     {
-        LogError("Wrt wrapper registration failed");
+        _E("Wrt wrapper registration failed");
         return;
     }
 }
 
 void on_widget_stop_callback(int widgetId)
 {
-    LogDebug("[W3C\\widget] on_widget_stop_callback (" << widgetId << ")");
+    _D("[W3C\\widget] on_widget_stop_callback (%d)", widgetId);
     Try
     {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
     }
     Catch(Commons::Exception)
     {
-        LogError("Wrt wrapper registration failed");
+        _E("Wrt wrapper registration failed");
         return;
     }
 }