Change macro log to dlog_print function 05/172105/1
authorJunghoon Park <jh9216.park@samsung.com>
Mon, 12 Mar 2018 01:47:01 +0000 (10:47 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Mon, 12 Mar 2018 01:47:01 +0000 (10:47 +0900)
- SDK does not support macro log such as LOGE, LOGI and LOGW

Change-Id: Ia670fe9743b594064c36e91511200ac906083370
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
idlc/c_gen/c_body_gen_base.cc
idlc/c_gen/c_proxy_body_gen.cc
idlc/c_gen/c_stub_body_gen.cc

index 24eea6f..5e8dfeb 100644 (file)
@@ -99,7 +99,7 @@ void CBodyGeneratorBase::GenStructureParcelSerializer(std::ofstream& stream,
       "    rpc_port_##_h h = data;\n" \
       "\n" \
       "    if (!parcel || !h) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return;\n" \
       "    }\n" \
       "$$" \
@@ -127,7 +127,7 @@ void CBodyGeneratorBase::GenStructureParcelDeserializer(std::ofstream& stream,
       "    rpc_port_##_h h = data;\n" \
       "\n"
       "    if (!parcel || !h) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG,\"Invalid parameter\");\n" \
       "        return;\n" \
       "    }\n" \
       "$$" \
@@ -155,13 +155,13 @@ void CBodyGeneratorBase::GenStructureConstructor(std::ofstream& stream,
       "    struct ##_s *handle;\n" \
       "\n" \
       "    if (!h) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
       "    handle = calloc(1, sizeof(struct ##_s));\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n"
@@ -183,7 +183,7 @@ void CBodyGeneratorBase::GenStructureDestructor(std::ofstream& stream,
       "int rpc_port_##_destroy(rpc_port_##_h h)\n" \
       "{\n" \
       "    if (!h) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -212,7 +212,7 @@ void CBodyGeneratorBase::GenStructureSetter(std::ofstream& stream,
       "int rpc_port_$$_$$_$$(rpc_port_$$_h h, $$$$)\n" \
       "{\n" \
       "    if ($$) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "$$" \
@@ -301,7 +301,7 @@ void CBodyGeneratorBase::GenStructureGetter(std::ofstream& stream,
       "int rpc_port_$$_get_$$(rpc_port_$$_h h, $$$$)\n" \
       "{\n" \
       "    if (!h || $$) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "$$" \
@@ -373,7 +373,7 @@ void CBodyGeneratorBase::GenStructureIterator(std::ofstream& stream,
       "void (*callback)($$$$, void *user_data), void *user_data)\n" \
       "{\n" \
       "    if (!h || !callback) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "$$" \
@@ -427,13 +427,13 @@ void CBodyGeneratorBase::GenStructureCloner(std::ofstream& stream,
       "    rpc_port_##_h handle = NULL;\n" \
       "\n" \
       "    if (!h || !clone) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
       "    rpc_port_##_create(&handle);\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Failed to create ## handle\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to create ## handle\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "$$" \
@@ -503,7 +503,7 @@ std::string CBodyGeneratorBase::GetParcelWriteString(const std::string& id,
       "\n" \
       "        iter = g_list_next(iter);\n" \
       "        if (!value) {\n" \
-      "            LOGW(\"Warning: value is NULL\");\n" \
+      "            dlog_print(DLOG_WARN, LOG_TAG, \"Warning: value is NULL\");\n" \
       "            continue;\n" \
       "        }\n" \
       "\n" \
@@ -620,7 +620,7 @@ std::string CBodyGeneratorBase::GetParcelReadString(const std::string& id,
       "\n" \
       "    h->## = calloc(h->##_size, sizeof(*h->##));\n" \
       "    if (!h->##) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return;\n" \
       "    }\n" \
       "\n" \
@@ -659,7 +659,7 @@ std::string CBodyGeneratorBase::GetParcelReadString(const std::string& id,
                 },
                 [&]()->std::string {
                   std::string ss;
-                  ss += "LOGE(\"Failed to create handle\");" + NLine(1);
+                  ss += "dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to create handle\");" + NLine(1);
                   ss += "return;" + NLine(1);
                   return ss;
                 }
@@ -691,7 +691,7 @@ std::string CBodyGeneratorBase::GetParcelReadString(const std::string& id,
                 },
                 [&]()->std::string {
                   std::string ss;
-                  ss += "LOGE(\"Out of memory\");" + NLine(1);
+                  ss += "dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");" + NLine(1);
                   ss += "return;" + NLine(1);
                   return ss;
                 }
@@ -746,7 +746,7 @@ std::string CBodyGeneratorBase::GetParcelReadString(const std::string& id,
                 },
                 [&]()->std::string {
                   std::string ss;
-                  ss += "LOGE(\"Failed to create handle\");" + NLine(1);
+                  ss += "dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to create handle\");" + NLine(1);
                   ss += "return;" + NLine(1);
                   return ss;
                 }
@@ -912,7 +912,7 @@ std::string CBodyGeneratorBase::GetSetterString(const std::string& id,
       "do {\n" \
       "    h->## = calloc(##_size, sizeof(*##));\n" \
       "    if (!h->##) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "    h->##_size = ##_size;\n" \
@@ -944,7 +944,7 @@ std::string CBodyGeneratorBase::GetSetterString(const std::string& id,
         },
         [&]()->std::string {
           std::string s;
-          s += "LOGE(\"Failed to duplicate data\");" + NLine(1);
+          s += "dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to duplicate data\");" + NLine(1);
           s += "return -1;" + NLine(1);
           return s;
         }
@@ -976,7 +976,7 @@ std::string CBodyGeneratorBase::GetSetterString(const std::string& id,
                 },
                 [&]()->std::string {
                   std::string s;
-                  s += "LOGE(\"Out of memory\");" + NLine(1);
+                  s += "dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");" + NLine(1);
                   s += "return -1;" + NLine(1);
                   return s;
                 }
@@ -1020,13 +1020,13 @@ std::string CBodyGeneratorBase::GetGetterString(const std::string& id,
   const char do_while_array[] =
       "do {\n" \
       "    if (h->##_size == 0) {\n" \
-      "        LOGW(\"## is empty\");\n" \
+      "        dlog_print(DLOG_WARN, LOG_TAG, \"## is empty\");\n" \
       "        break;\n" \
       "    }\n" \
       "\n" \
       "    *## = calloc(h->##_size, sizeof(*h->##));\n" \
       "    if (!*##) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "    *##_size = h->##_size;\n" \
@@ -1053,7 +1053,7 @@ std::string CBodyGeneratorBase::GetGetterString(const std::string& id,
           },
           [&]()->std::string {
             std::string s;
-            s += "LOGE(\"Invalid parameter: h->" + id +
+            s += "dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter: h->" + id +
                 " is NULL\");" + NLine(1);
             s += "return -1;" + NLine(1);
             return s;
@@ -1077,7 +1077,7 @@ std::string CBodyGeneratorBase::GetGetterString(const std::string& id,
           },
           [&]()->std::string {
             std::string s;
-            s += "LOGE(\"Failed to duplicate " + id + "\");" + NLine(1);
+            s += "dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to duplicate " + id + "\");" + NLine(1);
             s += "return -1;" + NLine(1);
             return s;
           }
@@ -1098,7 +1098,7 @@ std::string CBodyGeneratorBase::GetIteratorString(const std::string& id,
       "\n" \
       "       iter = g_list_next(iter);\n" \
       "       if (!value) {\n" \
-      "           LOGW(\"Warning: value is NULL\");\n" \
+      "           dlog_print(DLOG_WARN, LOG_TAG, \"Warning: value is NULL\");\n" \
       "           continue;\n" \
       "       }\n" \
       "\n" \
@@ -1144,7 +1144,7 @@ std::string CBodyGeneratorBase::GetClonerString(const std::string& id,
       "        $$value = iter->data;\n" \
       "\n" \
       "        if (!value) {\n" \
-      "            LOGE(\"Error: value is NULL\");\n" \
+      "            dlog_print(DLOG_ERROR, LOG_TAG, \"Error: value is NULL\");\n" \
       "            rpc_port_$$_destroy(handle);\n"
       "            return -1;\n" \
       "        }\n" \
@@ -1157,13 +1157,13 @@ std::string CBodyGeneratorBase::GetClonerString(const std::string& id,
   const char do_while_array[] =
       "do {\n" \
       "    if (h->##_size == 0) {\n" \
-      "        LOGW(\"## is empty\");\n" \
+      "        dlog_print(DLOG_WARN, LOG_TAG, \"## is empty\");\n" \
       "        break;\n" \
       "    }\n" \
       "\n" \
       "    handle->## = calloc(h->##_size, sizeof(*h->##));\n" \
       "    if (!handle->##) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "    handle->##_size = h->##_size;\n" \
@@ -1189,7 +1189,7 @@ std::string CBodyGeneratorBase::GetClonerString(const std::string& id,
               },
               [&]()->std::string {
                 std::string ss;
-                ss += "LOGE(\"Failed to duplicate h->" + id + "\");" +
+                ss += "dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to duplicate h->" + id + "\");" +
                     NLine(1);
                 ss += "rpc_port_" + st.GetID() + "_destroy(handle);" +
                     NLine(1);
@@ -1229,7 +1229,7 @@ std::string CBodyGeneratorBase::GetClonerString(const std::string& id,
                 },
               [&]()->std::string {
                 std::string ss;
-                ss += "LOGE(\"Failed to duplicate value\");" +
+                ss += "dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to duplicate value\");" +
                     NLine(1);
                 ss += "rpc_port_" + st.GetID() + "_destroy(handle);" +
                       NLine(1);
@@ -1245,7 +1245,7 @@ std::string CBodyGeneratorBase::GetClonerString(const std::string& id,
                 },
                 [&]()->std::string {
                   std::string tmp;
-                  tmp += "LOGE(\"Out of memory\");" + NLine(1);
+                  tmp += "dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");" + NLine(1);
                   tmp += "rpc_port_" + st.GetID() + "_destroy(handle);" +
                       NLine(1);
                   tmp += "return -1;" + NLine(1);
index a159b31..1e544e3 100644 (file)
@@ -125,7 +125,7 @@ void CProxyBodyGen::GenInterfaceDelegatorSerializer(
       "    struct ##_s *handle = data;\n" \
       "\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return;\n" \
       "    }\n" \
       "\n" \
@@ -144,7 +144,7 @@ void CProxyBodyGen::GenInterfaceDelegatorDeserializer(
       "    struct ##_s *handle = data;\n" \
       "\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return;\n" \
       "    }\n" \
       "\n" \
@@ -165,7 +165,7 @@ void CProxyBodyGen::GenInterfaceDelegatorConstructor(
       "\n" \
       "    handle = calloc(1, sizeof(struct ##_s));\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return NULL;\n" \
       "    }\n" \
       "\n" \
@@ -338,7 +338,7 @@ void CProxyBodyGen::GenInterfaceDelegatorHandler(std::ofstream& stream,
       "    if (__##_delegate_table[id])\n" \
                        "        __##_delegate_table[id](list, parcel, seq_id);\n" \
            "} else {\n" \
-                 "    LOGW(\"Unknown id(%d)\", id);\n" \
+                 "    dlog_print(DLOG_WARN, LOG_TAG, \"Unknown id(%d)\", id);\n" \
            "}\n";
   std::string str;
   int cnt = 0;
@@ -397,7 +397,7 @@ void CProxyBodyGen::GenInterfaceOnConnectedEventCB(std::ofstream& stream,
       "    handle->port = port;\n" \
       "    if (handle->callback.connected)\n" \
       "        handle->callback.connected(handle, handle->user_data);\n" \
-      "    LOGI(\"[__RPC_PORT__] endpoint(%s), port_name(%s)\", endpoint, port_name);\n" \
+      "    dlog_print(DLOG_INFO, LOG_TAG, \"[__RPC_PORT__] endpoint(%s), port_name(%s)\", endpoint, port_name);\n" \
       "}\n";
   stream << NLine(1);
   stream << SmartIndent(ReplaceAll(block, "##", inf.GetID()));
@@ -413,7 +413,7 @@ void CProxyBodyGen::GenInterfaceOnDisconnectedEventCB(std::ofstream& stream,
       "    handle->port = NULL;\n" \
       "    if (handle->callback.disconnected)\n" \
       "        handle->callback.disconnected(handle, handle->user_data);\n" \
-      "    LOGI(\"[__RPC_PORT__] endpoint(%s), port_name(%s)\", endpoint, port_name);\n" \
+      "    dlog_print(DLOG_INFO, LOG_TAG, \"[__RPC_PORT__] endpoint(%s), port_name(%s)\", endpoint, port_name);\n" \
       "}\n";
   stream << NLine(1);
   stream << SmartIndent(ReplaceAll(block, "##", inf.GetID()));
@@ -429,7 +429,7 @@ void CProxyBodyGen::GenInterfaceOnRejectedEventCB(std::ofstream& stream,
       "    handle->port = NULL;\n" \
       "    if (handle->callback.rejected)\n" \
       "        handle->callback.rejected(handle, handle->user_data);\n" \
-      "    LOGI(\"[__RPC_PORT__] endpoint(%s), port_name(%s)\", endpoint, port_name);\n" \
+      "    dlog_print(DLOG_INFO, LOG_TAG, \"[__RPC_PORT__] endpoint(%s), port_name(%s)\", endpoint, port_name);\n" \
       "}\n";
   stream << NLine(1);
   stream << SmartIndent(ReplaceAll(block, "##", inf.GetID()));
@@ -447,14 +447,14 @@ void CProxyBodyGen::GenInterfaceOnReceivedEventCB(std::ofstream& stream,
       "    rpc_port_parcel_create_from_port(&parcel_received, handle->port);\n" \
       "    rpc_port_parcel_read_int32(parcel_received, &cmd);\n" \
       "    if (cmd != ##_METHOD_Callback) {\n" \
-      "        LOGE(\"Invalid protocol\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid protocol\");\n" \
       "        rpc_port_parcel_destroy(parcel_received);\n" \
       "        return;\n" \
       "    }\n" \
       "\n" \
       "    __##_process_received_event(handle->delegates, parcel_received);\n" \
       "    rpc_port_parcel_destroy(parcel_received);\n" \
-      "    LOGI(\"[__RPC_PORT__] endpoint(%s), port_name(%s)\", endpoint, port_name);\n" \
+      "    dlog_print(DLOG_INFO, LOG_TAG, \"[__RPC_PORT__] endpoint(%s), port_name(%s)\", endpoint, port_name);\n" \
       "}\n";
   stream << NLine(1);
   stream << SmartIndent(ReplaceAll(block, "##", inf.GetID()));
@@ -469,12 +469,12 @@ void CProxyBodyGen::GenInterfaceMethods(std::ofstream& stream,
       "$$" \
       "\n" \
       "    if (!h$$) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return$$;\n" \
       "    }\n" \
       "\n" \
       "    if (!h->port) {\n" \
-      "        LOGE(\"Not connected\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Not connected\");\n" \
       "        return$$;\n" \
       "    }\n" \
       "\n" \
@@ -564,20 +564,20 @@ void CProxyBodyGen::GenInterfaceConstructor(std::ofstream& stream,
       "\n" \
       "    handle = calloc(1, sizeof(struct ##_s));\n" \
       "    if (!handle) {\n " \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return NULL;\n" \
       "    }\n" \
       "\n" \
       "    handle->stub_appid = strdup(stub_appid);\n" \
       "    if (!handle->stub_appid) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        free(handle);\n" \
       "        return NULL;\n" \
       "    }\n" \
       "\n" \
       "    rpc_port_proxy_create(&handle->proxy);\n" \
       "    if (!handle->proxy) {\n" \
-      "        LOGE(\"Failed to create proxy\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to create proxy\");\n" \
       "        free(handle->stub_appid);\n" \
       "        free(handle);\n" \
       "        return NULL;\n" \
@@ -621,7 +621,7 @@ void CProxyBodyGen::GenInterfaceConnect(std::ofstream& stream,
       "    int r;\n" \
       "\n" \
       "    if (!stub_appid || !callback || !h) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -631,35 +631,35 @@ void CProxyBodyGen::GenInterfaceConnect(std::ofstream& stream,
       "\n"  \
       "    r = rpc_port_proxy_add_connected_event_cb(handle->proxy, __##_on_connected, handle);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to add connected event cb. err = %d\", r);\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add connected event cb. err = %d\", r);\n" \
       "        __destroy_##(handle);\n" \
       "        return r;\n" \
       "    }\n" \
       "\n" \
       "    r = rpc_port_proxy_add_disconnected_event_cb(handle->proxy, __##_on_disconnected, handle);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to add disconnected event cb. err = %d\", r);\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add disconnected event cb. err = %d\", r);\n" \
       "        __destroy_##(handle);\n" \
       "        return r;\n" \
       "    }\n" \
       "\n" \
       "    r = rpc_port_proxy_add_rejected_event_cb(handle->proxy, __##_on_rejected, handle);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to add rejected event cb. err = %d\", r);\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add rejected event cb. err = %d\", r);\n" \
       "        __destroy_##(handle);\n" \
       "        return r;\n" \
       "    }\n" \
       "\n" \
       "    r = rpc_port_proxy_add_received_event_cb(handle->proxy, __##_on_received, handle);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to add received event cb. err = %d\", r);\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add received event cb. err = %d\", r);\n" \
       "        __destroy_##(handle);\n" \
       "        return r;\n" \
       "    }\n" \
       "\n" \
       "    r = rpc_port_proxy_connect(handle->proxy, stub_appid, \"##\");\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to connect ##(%s)\", stub_appid);\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to connect ##(%s)\", stub_appid);\n" \
       "        __destroy_##(handle);\n" \
       "        return r;\n" \
       "    }\n" \
@@ -678,7 +678,7 @@ void CProxyBodyGen::GenInterfaceDisconnect(std::ofstream& stream,
       "int rpc_port_proxy_##_disconnect(rpc_port_proxy_##_h h)\n" \
       "{\n" \
       "    if (!h) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -746,7 +746,7 @@ std::string CProxyBodyGen::GetMethodReadString(const Interface& inf,
       "\n" \
       "    parcel_received = __$$_consume_command(h);\n" \
       "    if (!parcel_received) {\n" \
-      "        LOGE(\"Invalid protocol\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid protocol\");\n" \
       "        break;\n" \
       "    }\n" \
       "\n" \
index c6e991a..239374a 100644 (file)
@@ -139,7 +139,7 @@ void CStubBodyGen::GenInterfaceOnConnectedEventCB(std::ofstream& stream,
       "{\n" \
       "    rpc_port_stub_##_context_h context;\n" \
       "\n" \
-      "    LOGI(\"[__RPC_PORT__] sender(%s), instance(%s)\", sender, instance);\n" \
+      "    dlog_print(DLOG_INFO, LOG_TAG, \"[__RPC_PORT__] sender(%s), instance(%s)\", sender, instance);\n" \
       "    context = __create_##_context(sender, instance);\n" \
       "    if (!context)\n" \
       "        return;\n" \
@@ -160,7 +160,7 @@ void CStubBodyGen::GenInterfaceOnDisconnectedEventCB(std::ofstream& stream,
       "{\n" \
       "    rpc_port_stub_##_context_h context;\n" \
       "\n" \
-           "    LOGI(\"[__RPC_PORT__] sender(%s), instance(%s)\", sender, instance);\n" \
+           "    dlog_print(DLOG_INFO, LOG_TAG, \"[__RPC_PORT__] sender(%s), instance(%s)\", sender, instance);\n" \
            "    context = __find_##_context(instance);\n" \
            "    if (!context)\n" \
                  "        return;\n" \
@@ -185,17 +185,17 @@ void CStubBodyGen::GenInterfaceOnReceivedEventCB(std::ofstream& stream,
       "    int cmd = -1;\n" \
       "    int r;\n" \
       "\n" \
-      "    LOGI(\"[__RPC_PORT__] sender(%s), instance(%s)\", sender, instance);\n" \
+      "    dlog_print(DLOG_INFO, LOG_TAG, \"[__RPC_PORT__] sender(%s), instance(%s)\", sender, instance);\n" \
       "    context = __find_##_context(instance);\n" \
       "    if (!context) {\n" \
-      "        LOGE(\"Failed to find ## context(%s)\", instance);\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to find ## context(%s)\", instance);\n" \
       "        return -1;\n" \
       "    }\n" \
       "    context->port = port;\n" \
       "\n" \
       "    r = rpc_port_parcel_create_from_port(&parcel, port);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to create parcel from port\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to create parcel from port\");\n" \
       "        return r;\n" \
       "    }\n" \
       "\n" \
@@ -204,7 +204,7 @@ void CStubBodyGen::GenInterfaceOnReceivedEventCB(std::ofstream& stream,
       "         if (__##_method_table[cmd])\n"
       "             r = __##_method_table[cmd](port, parcel, context);\n" \
       "    } else {\n" \
-      "         LOGE(\"Unknown Command(%d)\", cmd);\n" \
+      "         dlog_print(DLOG_ERROR, LOG_TAG, \"Unknown Command(%d)\", cmd);\n" \
       "         r = -1;\n" \
       "    }\n"
       "\n" \
@@ -225,12 +225,12 @@ void CStubBodyGen::GenInterfaceRegister(std::ofstream& stream,
       "    int r;\n" \
       "\n" \
       "    if (__##_stub) {\n" \
-      "        LOGW(\"Already exists\");\n" \
+      "        dlog_print(DLOG_WARN, LOG_TAG, \"Already exists\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
       "    if (!callback) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -238,13 +238,13 @@ void CStubBodyGen::GenInterfaceRegister(std::ofstream& stream,
       "    __##_user_data = user_data;\n" \
       "    r = rpc_port_stub_create(&__##_stub, \"##\");\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to create stub handle\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to create stub handle\");\n" \
       "        return r;\n" \
       "    }\n" \
       "\n" \
       "    r = rpc_port_stub_add_received_event_cb(__##_stub, __##_on_received, NULL);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to add received event callback\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add received event callback\");\n" \
       "        rpc_port_stub_destroy(__##_stub);\n" \
       "         __##_stub = NULL;\n" \
       "        return r;\n" \
@@ -252,7 +252,7 @@ void CStubBodyGen::GenInterfaceRegister(std::ofstream& stream,
       "\n" \
       "    r = rpc_port_stub_add_connected_event_cb(__##_stub, __##_on_connected, NULL);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to add connected event callback\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add connected event callback\");\n" \
       "        rpc_port_stub_destroy(__##_stub);\n" \
       "        __##_stub = NULL;\n" \
       "        return r;\n" \
@@ -260,7 +260,7 @@ void CStubBodyGen::GenInterfaceRegister(std::ofstream& stream,
       "\n" \
       "    r = rpc_port_stub_add_disconnected_event_cb(__##_stub, __##_on_disconnected, NULL);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to add disconnected event callback\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add disconnected event callback\");\n" \
       "        rpc_port_stub_destroy(__##_stub);\n" \
       "        __##_stub = NULL;\n" \
       "        return r;\n" \
@@ -268,7 +268,7 @@ void CStubBodyGen::GenInterfaceRegister(std::ofstream& stream,
       "\n" \
       "    r = __##_add_privileges();\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to add privileges\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add privileges\");\n" \
       "        rpc_port_stub_destroy(__##_stub);\n" \
       "        __##_stub = NULL;\n" \
       "        return r;\n" \
@@ -276,7 +276,7 @@ void CStubBodyGen::GenInterfaceRegister(std::ofstream& stream,
       "\n" \
       "    r = rpc_port_stub_listen(__##_stub);\n" \
       "    if (r != 0) {\n" \
-      "        LOGE(\"Failed to listen stub\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to listen stub\");\n" \
       "        rpc_port_stub_destroy(__##_stub);\n" \
       "        __##_stub = NULL;\n" \
       "        return r;\n" \
@@ -484,7 +484,7 @@ std::string CStubBodyGen::GetAddPrivilegeString(const std::string& id,
   const char format[] =
       "r = $$;\n" \
       "if (r != 0) {\n" \
-      "    LOGE(\"Failed to add privilege($$)\");\n" \
+      "    dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to add privilege($$)\");\n" \
       "    return r;\n" \
       "}\n";
   std::string str;
@@ -552,13 +552,13 @@ void CStubBodyGen::GenInterfaceDelegatorConstructor(std::ofstream& stream,
       "    static int seq_num;\n" \
       "\n" \
       "    if (!h) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
       "    handle = calloc(1, sizeof(struct ##_s));\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -592,7 +592,7 @@ void CStubBodyGen::GenInterfaceDelegatorDestructor(std::ofstream& stream,
       "int rpc_port_##_destroy(rpc_port_##_h h)\n" \
       "{\n" \
       "    if (!h) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -614,7 +614,7 @@ void CStubBodyGen::GenInterfaceDelegatorSerializer(std::ofstream& stream,
       "    rpc_port_##_h handle = data;\n" \
       "\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return;\n" \
       "    }\n" \
       "\n" \
@@ -635,7 +635,7 @@ void CStubBodyGen::GenInterfaceDelegatorDeserializer(std::ofstream& stream,
       "    rpc_port_##_h handle = data;\n" \
       "\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return;\n" \
       "    }\n" \
       "\n" \
@@ -656,13 +656,13 @@ void CStubBodyGen::GenInterfaceDelegatorCloner(std::ofstream& stream,
       "    rpc_port_##_h handle;\n" \
       "\n" \
       "    if (!h || !clone) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
       "    handle = calloc(1, sizeof(struct ##_s));\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -690,18 +690,18 @@ void CStubBodyGen::GenInterfaceDelegatorInvoker(std::ofstream& stream,
       "    rpc_port_parcel_h parcel = NULL;\n" \
       "\n" \
       "    if (!h || !h->port) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
       "    if (!__$$_context_port_exist(h->port)) {\n" \
-      "        LOGE(\"Port doesn't exist\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Port doesn't exist\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
       "    rpc_port_parcel_create(&parcel);\n" \
       "    if (!parcel) {\n" \
-      "        LOGE(\"Failed to create parcel\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Failed to create parcel\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -765,7 +765,7 @@ void CStubBodyGen::GenInterfaceDelegatorPortSetter(std::ofstream& stream,
       "int rpc_port_##_set_port(rpc_port_##_h h, rpc_port_h port)\n" \
       "{\n" \
       "    if (!h || !port) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -814,20 +814,20 @@ void CStubBodyGen::GenInterfaceContextConstructor(std::ofstream& stream,
       "\n"
       "    handle = calloc(1, sizeof(struct ##_context_s));\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return NULL;\n" \
       "    }\n" \
       "\n" \
       "    handle->sender = strdup(sender);\n" \
       "    if (!handle->sender) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        free(handle);\n" \
       "        return NULL;\n" \
       "    }\n" \
       "\n" \
       "    handle->instance = strdup(instance);\n" \
       "    if (!handle->instance) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        free(handle->sender);\n" \
       "        free(handle);\n" \
       "        return NULL;\n" \
@@ -850,7 +850,7 @@ void CStubBodyGen::GenInterfaceContextDestructor(std::ofstream& stream,
       "    struct ##_context_s *handle = data;\n" \
       "\n" \
       "    if (!handle) {\n" \
-      "        LOGE(\"Critical error!\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Critical error!\");\n" \
       "        return;\n" \
       "    }\n" \
       "\n" \
@@ -890,7 +890,7 @@ void CStubBodyGen::GenInterfaceContextTagSetter(std::ofstream& stream,
       "int rpc_port_stub_##_context_set_tag(rpc_port_stub_##_context_h ctx, void *tag)\n" \
       "{\n" \
       "    if (!ctx) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -908,7 +908,7 @@ void CStubBodyGen::GenInterfaceContextTagGetter(std::ofstream& stream,
       "int rpc_port_stub_##_context_get_tag(rpc_port_stub_##_context_h ctx, void **tag)\n" \
       "{\n" \
       "    if (!ctx || !tag) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
@@ -926,13 +926,13 @@ void CStubBodyGen::GenInterfaceContextSenderGetter(std::ofstream& stream,
       "int rpc_port_stub_##_context_get_sender(rpc_port_stub_##_context_h ctx, char **sender)\n" \
       "{\n" \
       "    if (!ctx || !sender) {\n" \
-      "        LOGE(\"Invalid parameter\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Invalid parameter\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \
       "    *sender = strdup(ctx->sender);\n" \
       "    if (*sender == NULL) {\n" \
-      "        LOGE(\"Out of memory\");\n" \
+      "        dlog_print(DLOG_ERROR, LOG_TAG, \"Out of memory\");\n" \
       "        return -1;\n" \
       "    }\n" \
       "\n" \