wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / DataSync / JSSyncInfo.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 076ae96..4ab0054
 #include "JSSyncInfo.h"
 #include "DataSyncConverter.h"
 
-#include <dpl/log/log.h>
 #include <JSTizenException.h>
 #include <JSTizenExceptionFactory.h>
 #include <CommonsJavaScript/Converter.h>
+#include <Logger.h>
 
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
@@ -88,14 +88,14 @@ void JSSyncInfo::initialize(JSContextRef context,
         JSObjectRef object)
 {
     if (!JSObjectGetPrivate(object)) {
-        LogDebug("Create JSSyncInfo private object.");
+        LoggerD("Create JSSyncInfo private object.");
         SyncInfoPtr syncInfo( new SyncInfo() );
         SyncInfoPrivateObject *priv = new SyncInfoPrivateObject(context, syncInfo);
         if (!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
             delete priv;
         }
     } else {
-        LogDebug("Private object already set.");
+        LoggerD("Private object already set.");
     }
 }
 
@@ -103,7 +103,7 @@ void JSSyncInfo::finalize(JSObjectRef object)
 {
     SyncInfoPrivateObject* priv = static_cast<SyncInfoPrivateObject*>(JSObjectGetPrivate(object));
     if (priv) {
-        LogDebug("Deleting JSSyncInfo private object.");
+        LoggerD("Deleting JSSyncInfo private object.");
         delete priv;
         JSObjectSetPrivate(object, NULL);
     }
@@ -138,7 +138,7 @@ void JSSyncInfo::setPrivateObject(const SyncInfoPtr &syncInfo,
     }
     Catch(Exception)
     {
-        LogError("Error during setting JSSyncInfo object.");
+        LoggerE("Error during setting JSSyncInfo object.");
     }
 }
 
@@ -167,7 +167,7 @@ JSObjectRef JSSyncInfo::constructor(JSContextRef context,
                        syncInfo->setSyncMode(converter.toSyncMode(converter.toString(arguments[3])));
         }
 
-        LogDebug("url: "<<syncInfo->getUrl()<<", id: "<<syncInfo->getId()<<", password: "<<syncInfo->getPassword()<<", mode: "<<syncInfo->getSyncMode());
+        LoggerD("url: "<<syncInfo->getUrl()<<", id: "<<syncInfo->getId()<<", password: "<<syncInfo->getPassword()<<", mode: "<<syncInfo->getSyncMode());
 
                if (SyncInfo::MANUAL_MODE==syncInfo->getSyncMode()) {
                        if (argumentCount>=5) {
@@ -178,29 +178,29 @@ JSObjectRef JSSyncInfo::constructor(JSContextRef context,
                                syncInfo->setSyncInterval(converter.toSyncInterval(converter.toString(arguments[4])));
                        }
                } else {
-                       LogDebug("The sync mode should be push.");
+                       LoggerD("The sync mode should be push.");
                }
 
         return createJSSyncInfo(context, syncInfo);
     }
     Catch(UnsupportedException)
     {
-        LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+        LoggerW("Exception: "<<_rethrown_exception.GetMessage());
         *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage());
     }
     Catch(InvalidArgumentException)
     {
-        LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+        LoggerW("Exception: "<<_rethrown_exception.GetMessage());
         *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage());
     }
     Catch(ConversionException)
     {
-        LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+        LoggerW("Exception: "<<_rethrown_exception.GetMessage());
         *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
     }
     Catch(Exception)
     {
-        LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+        LoggerW("Exception: "<<_rethrown_exception.GetMessage());
         *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage());
     }
 
@@ -238,12 +238,12 @@ JSValueRef JSSyncInfo::getProperty(JSContextRef context,
                } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_SYNC_INFO_INTERVAL)) {
             return converter.toJSValueRef(converter.toTizenValue(syncInfo->getSyncInterval()));
                } else {
-                       LogDebug("Wrong property name.");
+                       LoggerD("Wrong property name.");
                }
     }
     Catch(Exception)
     {
-               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+               LoggerW("Exception: "<<_rethrown_exception.GetMessage());
     }
 
     return JSValueMakeUndefined(context);
@@ -285,12 +285,12 @@ bool JSSyncInfo::setProperty(JSContextRef context,
                        syncInfo->setSyncInterval(converter.toSyncInterval(converter.toString(value)));
                        return true;
         } else {
-               LogDebug("Wrong property name.");
+               LoggerD("Wrong property name.");
                }
     }
     Catch(Exception)
     {
-               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+               LoggerW("Exception: "<<_rethrown_exception.GetMessage());
     }
 
     return true;