wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / NFC / JSNFCTarget.cpp
index 8e3e86d..addb719 100644 (file)
@@ -15,9 +15,6 @@
 // limitations under the License.
 //
 
-
-#include <dpl/log/log.h>
-
 #include <CommonsJavaScript/Validator.h>
 #include <Commons/Exception.h>
 #include <CommonsJavaScript/PrivateObject.h>
@@ -42,6 +39,7 @@
 #include "NFCFactory.h"
 #include "EventTargetAction.h"
 #include "plugin_config.h"
+#include <Logger.h>
 
 
 using namespace DeviceAPI::Common;
@@ -95,7 +93,7 @@ JSStaticFunction JSNFCTarget::m_function[] = {
 JSClassRef JSNFCTarget::m_jsClassRef = JSClassCreate(JSNFCTarget::getClassInfo());
 
 JSObjectRef JSNFCTarget::createJSObject(JSContextRef context, void *tagHandle) {
-       LogDebug("entered");
+       LoggerD("entered");
 
        INFCTargetPtr nfcTarget = NFCFactory::getInstance().createNFCTargetObject(tagHandle);
 
@@ -114,10 +112,10 @@ void JSNFCTarget::initialize(JSContextRef context, JSObjectRef object)
 
 void JSNFCTarget::finalize(JSObjectRef object)
 {
-       LogDebug( "entered" );
+       LoggerD( "entered" );
        NFCTargetPrivObject *priv = static_cast<NFCTargetPrivObject*>( JSObjectGetPrivate( object ) ) ;
        JSObjectSetPrivate(object, NULL);
-       LogDebug("Deleting timezone object");
+       LoggerD("Deleting timezone object");
        delete priv;
 }
 
@@ -138,13 +136,13 @@ const JSClassDefinition* JSNFCTarget::getClassInfo()
 JSValueRef JSNFCTarget::getProperty(JSContextRef context, JSObjectRef object,
         JSStringRef propertyName, JSValueRef* exception)
 {
-       LogDebug("Enter");
+       LoggerD("Enter");
 
        Try     {
                if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCTARGET_ISCONNECTED)) {
                        NFCTargetPrivObject* privateObject = static_cast<NFCTargetPrivObject*>(JSObjectGetPrivate(object));
                        if (!privateObject) {
-                               LogError("Private object is not set.");
+                               LoggerE("Private object is not set.");
                                ThrowMsg(NullPointerException, "Private object not initialized");
                        }
 
@@ -153,15 +151,15 @@ JSValueRef JSNFCTarget::getProperty(JSContextRef context, JSObjectRef object,
                        return convert.toJSValueRef(nfcTarget->isConnected());
                }
        } Catch (ConversionException) {
-               LogError("ConversionException: " << _rethrown_exception.GetMessage());
+               LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
        } Catch (NullPointerException) {
-               LogError("NullPointerException: " << _rethrown_exception.GetMessage());
+               LoggerE("NullPointerException: " << _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);
 }
@@ -181,7 +179,7 @@ JSValueRef JSNFCTarget::setReceiveNDEFListener(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       LogDebug("Entered ");
+       LoggerD("Entered ");
 
        AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -190,7 +188,7 @@ JSValueRef JSNFCTarget::setReceiveNDEFListener(JSContextRef context,
 
        NFCTargetPrivObject* privateObject = static_cast<NFCTargetPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
-               LogError("private object is null");
+               LoggerE("private object is null");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
        
@@ -216,18 +214,18 @@ JSValueRef JSNFCTarget::setReceiveNDEFListener(JSContextRef context,
 
                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("setReceiveNDEFListener : ConversionException");
+               LoggerE("setReceiveNDEFListener : ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } 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");
@@ -240,7 +238,7 @@ JSValueRef JSNFCTarget::unsetReceiveNDEFListener(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       LogDebug("Entered ");
+       LoggerD("Entered ");
        Try {
                AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS);
                TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -249,7 +247,7 @@ JSValueRef JSNFCTarget::unsetReceiveNDEFListener(JSContextRef context,
 
                NFCTargetPrivObject* privateObject = static_cast<NFCTargetPrivObject*>(JSObjectGetPrivate(thisObject));
                if (NULL == privateObject) {
-                       LogError("private object is null");
+                       LoggerE("private object is null");
                        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
                }
 
@@ -262,15 +260,15 @@ JSValueRef JSNFCTarget::unsetReceiveNDEFListener(JSContextRef context,
 
                return JSValueMakeUndefined(context);
        } Catch (WrtDeviceApis::Commons::UnknownException) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        } Catch(NullPointerException) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } 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::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
+               LoggerE("Exception: " << _rethrown_exception.GetMessage());
        }
 
        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
@@ -283,7 +281,7 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       LogDebug("Entered ");
+       LoggerD("Entered ");
 
        AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -294,7 +292,7 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context,
 
        NFCTargetPrivObject* privateObject = static_cast<NFCTargetPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
-               LogError("private object is null");
+               LoggerE("private object is null");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
@@ -320,23 +318,23 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context,
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                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("sendNDEF : ConversionException");
+               LoggerE("sendNDEF : ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (InvalidArgumentException) {
-               LogError("sendNDEF InvalidArgumentException");
+               LoggerE("sendNDEF InvalidArgumentException");
                callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"));
                return JSValueMakeUndefined(context);
        } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
+               LoggerE("PlatformException: " << _rethrown_exception.GetMessage());
                callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"));
                return JSValueMakeUndefined(context);
        } 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());
        }
 
        callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error"));