wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / NFC / JSNFCManager.cpp
index 7867efb..3c1ddcc 100644 (file)
@@ -15,9 +15,6 @@
 // limitations under the License.
 //
 
-
-#include <dpl/log/log.h>
-
 #include <Commons/Exception.h>
 #include <CommonsJavaScript/PrivateObject.h>
 #include <JSTizenExceptionFactory.h>
@@ -34,6 +31,7 @@
 #include "NFCFactory.h"
 #include "plugin_config.h"
 #include "NFCDefaultAdapter.h"
+#include <Logger.h>
 
 using namespace std;
 using namespace DPL;
@@ -98,34 +96,34 @@ JSClassRef JSNFCManager::m_jsClassRef = JSClassCreate(JSNFCManager::getClassInfo
 
 void JSNFCManager::initialize(JSContextRef context, JSObjectRef object)
 {
-       LogDebug("entered");
+       LoggerD("entered");
        NFCManagerPrivObject* priv = static_cast<NFCManagerPrivObject*>(JSObjectGetPrivate(object));
        if (!priv) {
                Try {
                        priv = new NFCManagerPrivObject(context);
                        if(!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
-                               LogError("Object can't store private data.");
+                               LoggerE("Object can't store private data.");
                                delete priv;
                        }
                } Catch (UnsupportedException) {
-                       LogError("UnsupportedException: " << _rethrown_exception.GetMessage());
+                       LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage());
                } Catch (WrtDeviceApis::Commons::UnknownException) {
-                       LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage());
+                       LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage());
                } Catch (PlatformException) {
-                       LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage());
+                       LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage());
                } Catch (WrtDeviceApis::Commons::Exception) {
-                       LogError("Exception: " << _rethrown_exception.GetMessage());
+                       LoggerE("Exception: " << _rethrown_exception.GetMessage());
                }
        }
 }
 
 void JSNFCManager::finalize(JSObjectRef object)
 {
-       LogDebug( "entered" );
+       LoggerD( "entered" );
        NFCManagerPrivObject *priv = static_cast<NFCManagerPrivObject*>(JSObjectGetPrivate(object));
        if (priv) {
                JSObjectSetPrivate(object, NULL);
-               LogDebug("Deleting NFC Manager object");
+               LoggerD("Deleting NFC Manager object");
                delete priv;
        }
 }
@@ -147,7 +145,7 @@ const JSClassDefinition* JSNFCManager::getClassInfo()
 JSValueRef JSNFCManager::getProperty(JSContextRef context, JSObjectRef object,
         JSStringRef propertyName, JSValueRef* exception)
 {
-       LogDebug("Enter");
+       LoggerD("Enter");
 
        Try     {
                Converter convert(context);
@@ -168,15 +166,15 @@ JSValueRef JSNFCManager::getProperty(JSContextRef context, JSObjectRef object,
                        return convert.toJSValueRef(NFC_TNF_UNCHANGED);
                }
        } Catch (ConversionException) {
-               LogError("ConversionException: " << _rethrown_exception.GetMessage());
+               LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
        } Catch (UnsupportedException) {
-               LogError("UnsupportedException: " << _rethrown_exception.GetMessage());
+               LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::UnknownException) {
-               LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage());
+               LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage());
        } Catch (PlatformException) {
-               LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage());
+               LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
     return JSValueMakeUndefined(context);
@@ -185,7 +183,7 @@ JSValueRef JSNFCManager::getProperty(JSContextRef context, JSObjectRef object,
 JSValueRef JSNFCManager::getDefaultAdapter (JSContextRef context, JSObjectRef object,
                JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
                JSValueRef* exception) {
-       LogDebug("Enter");
+       LoggerD("Enter");
 
        Try {
                AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_COMMON_FUNCS);
@@ -193,29 +191,29 @@ JSValueRef JSNFCManager::getDefaultAdapter (JSContextRef context, JSObjectRef ob
 
                NFCManagerPrivObject* privateObject = static_cast<NFCManagerPrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
-                       LogError("private object is null");
+                       LoggerE("private object is null");
                        ThrowMsg(UnsupportedException, "private object is null");
                }
                return JSNFCAdapter::createJSObject(GlobalContextManager::getInstance()->getGlobalContext(context));
        } Catch (UnsupportedException) {
-               LogError("UnsupportedException: " << _rethrown_exception.GetMessage());
+               LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Not Supported");
        } Catch (ConversionException) {
-               LogError("ConversionException: " << _rethrown_exception.GetMessage());
+               LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (NullPointerException) {
-               LogError("NullPointerException: " << _rethrown_exception.GetMessage());
+               LoggerE("NullPointerException: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (InvalidArgumentException) {
-               LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage());
+               LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");
        } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
+               LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
        } Catch (WrtDeviceApis::Commons::UnknownException) {
-               LogError("UnknownException: " << _rethrown_exception.GetMessage());
+               LoggerE("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
 }
@@ -223,7 +221,7 @@ JSValueRef JSNFCManager::getDefaultAdapter (JSContextRef context, JSObjectRef ob
 JSValueRef JSNFCManager::setExclusiveMode (JSContextRef context, JSObjectRef object,
                JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
                JSValueRef* exception) {
-       LogDebug("Enter");
+       LoggerD("Enter");
 
        Try {
                AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_COMMON_FUNCS);
@@ -232,27 +230,27 @@ JSValueRef JSNFCManager::setExclusiveMode (JSContextRef context, JSObjectRef obj
                ArgumentValidator validator(context, argumentCount, arguments);
                // mode
         bool mode = validator.toBool(0);
-               LogDebug("mode : " << mode);
+               LoggerD("mode : " << mode);
                NFCManagerPrivObject* privateObject = static_cast<NFCManagerPrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
-                       LogError("private object is null");
+                       LoggerE("private object is null");
                        ThrowMsg(UnsupportedException, "private object is null");
                }
                NFCDefaultAdapterSingleton::Instance().setExclusiveMode(mode);
                return JSValueMakeUndefined(context);
     } Catch (BasePlatformException) {
-        LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage());
+        LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage());
         return JSWebAPIException::throwException(context, exception, _rethrown_exception);
        } Catch (ConversionException) {
-               LogError("ConversionException: " << _rethrown_exception.GetMessage());
+               LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (NullPointerException) {
-               LogError("NullPointerException: " << _rethrown_exception.GetMessage());
+               LoggerE("NullPointerException: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (WrtDeviceApis::Commons::UnknownException) {
-               LogError("UnknownException: " << _rethrown_exception.GetMessage());
+               LoggerE("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
 }