Remove cyclic call of dlog 34/240334/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 5 Aug 2020 11:22:13 +0000 (20:22 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 5 Aug 2020 11:24:52 +0000 (20:24 +0900)
LOGD or LOGW in sticker_log.cpp makes infinite recursion calls.

Change-Id: I8e72a30c2c994fa0901150443f34a2145aa44d0c
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
receiver/inc/log.h
receiver/src/ft.cpp
receiver/src/main.cpp
receiver/src/message.cpp
receiver/src/sticker_info.cpp

index 43a3aa6..0e9c66d 100644 (file)
@@ -31,19 +31,14 @@ void sticker_save_log (const char *fmt, ...);
        sticker_save_log("pid(%d) %s : %s(%d) > " fmt, getpid(), rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
 } while (0)
 
-#undef LOGD
-#define LOGD(format, arg...) _STICKER_RECEIVER_LOG(DLOG_DEBUG, format, ##arg)
+#define STLOGD(format, arg...) _STICKER_RECEIVER_LOG(DLOG_DEBUG, format, ##arg)
 
-#undef LOGI
-#define LOGI(format, arg...) _STICKER_RECEIVER_LOG(DLOG_INFO, format, ##arg)
+#define STLOGI(format, arg...) _STICKER_RECEIVER_LOG(DLOG_INFO, format, ##arg)
 
-#undef LOGW
-#define LOGW(format, arg...) _STICKER_RECEIVER_LOG(DLOG_WARN, format, ##arg)
+#define STLOGW(format, arg...) _STICKER_RECEIVER_LOG(DLOG_WARN, format, ##arg)
 
-#undef LOGE
-#define LOGE(format, arg...) _STICKER_RECEIVER_LOG(DLOG_ERROR, format, ##arg)
+#define STLOGE(format, arg...) _STICKER_RECEIVER_LOG(DLOG_ERROR, format, ##arg)
 
-#undef LOGF
-#define LOGF(format, arg...) _STICKER_RECEIVER_LOG(DLOG_FATAL, format, ##arg)
+#define STLOGF(format, arg...) _STICKER_RECEIVER_LOG(DLOG_FATAL, format, ##arg)
 
-#endif /* __debug_H__ */
\ No newline at end of file
+#endif /* __debug_H__ */
index dd20ce5..eda0692 100644 (file)
@@ -101,7 +101,7 @@ static void save_last_sync_time()
         LOGI("Succeed to set last sync time : %f", current_time);
     }
     else {
-        LOGW("Failed to set last sync time");
+        STLOGW("Failed to set last sync time");
     }
 }
 
@@ -111,9 +111,9 @@ static void set_sync_first_complete()
     if (vconf_get_int(VCONFKEY_STICKER_SYNC_COMPLETE, &complete_flags) == 0 && complete_flags == 0) {
         // first sync
         if (vconf_set_int(VCONFKEY_STICKER_SYNC_COMPLETE, VCONFKEY_STICKER_SYNC_COMPLETE_DONE) == 0)
-            LOGD("Succeed to set sync complete");
+            STLOGD("Succeed to set sync complete");
         else
-            LOGW("Fail to set sync complete");
+            STLOGW("Fail to set sync complete");
     }
 }
 
@@ -127,13 +127,13 @@ static void set_sync_progressing(gboolean flag)
 {
     job_progress = flag;
 #ifdef VCONFKEY_STICKER_SYNC_STATE
-    LOGD("sync progressing : %d", flag);
+    STLOGD("sync progressing : %d", flag);
     if (vconf_set_int(VCONFKEY_STICKER_SYNC_STATE, flag ? VCONFKEY_STICKER_SYNC_STATE_IN_PROGRESS :  VCONFKEY_STICKER_SYNC_STATE_WAITING) == 0)
-        LOGD("Succeed to set sync state");
+        STLOGD("Succeed to set sync state");
     else
-        LOGW("Fail to set sync state");
+        STLOGW("Fail to set sync state");
 #else
-    LOGW("No vconf sync state definition");
+    STLOGW("No vconf sync state definition");
 #endif
 }
 
@@ -147,13 +147,13 @@ static gboolean _send_json_data(JsonObject *obj)
 
     j_generator = json_generator_new();
     if (j_generator == NULL) {
-        LOGE("Unable to json_generator_new");
+        STLOGE("Unable to json_generator_new");
         goto cleanup;
     }
 
     j_node = json_node_new(JSON_NODE_OBJECT);
     if (j_node == NULL) {
-        LOGE("Unable to json_node_new");
+        STLOGE("Unable to json_node_new");
         goto cleanup;
     }
 
@@ -162,12 +162,12 @@ static gboolean _send_json_data(JsonObject *obj)
 
     data = json_generator_to_data(j_generator, &size);
     if (data == NULL) {
-        LOGE("Unable to json_generator_to_data");
+        STLOGE("Unable to json_generator_to_data");
         goto cleanup;
     }
 
     if (priv_data.socket) {
-        LOGD("Send JSON data : %s", data);
+        STLOGD("Send JSON data : %s", data);
         result = sap_socket_send_data(priv_data.socket, ACCESSORY_SERVICE_CHANNEL_ID, strlen(data), (void *)data);
     }
 
@@ -207,7 +207,7 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction,
         LOGI("Transfer Completed");
 
         if (chmod(sticker_data.file_path.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) {
-            LOGE("Failed to change permission : %s. error : %s", sticker_data.file_path.c_str(), strerror(errno));
+            STLOGE("Failed to change permission : %s. error : %s", sticker_data.file_path.c_str(), strerror(errno));
         }
         else {
             LOGI("Succeed to change permission : %s", sticker_data.file_path.c_str());
@@ -222,7 +222,7 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction,
 
             int ret = thumbnail_util_extract_to_file(sticker_data.file_path.c_str(), THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, sticker_data.thumbnail_path.c_str());
             if (ret != THUMBNAIL_UTIL_ERROR_NONE) {
-                LOGE("Failed to create thumbnail. msg : %s", get_error_message(ret));
+                STLOGE("Failed to create thumbnail. msg : %s", get_error_message(ret));
                 sticker_data.thumbnail_path.clear();
             }
 
@@ -230,11 +230,11 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction,
                                 sticker_data.thumbnail_path.c_str(), sticker_data.disp_type.c_str());
 
             if (unlink(sticker_data.file_path.c_str()) == -1)
-                LOGE("Failed to remove sticker file");
+                STLOGE("Failed to remove sticker file");
 
             if (!sticker_data.thumbnail_path.empty()) {
                 if (unlink(sticker_data.thumbnail_path.c_str()) == -1)
-                    LOGE("Failed to remove sticker thumbnail");
+                    STLOGE("Failed to remove sticker thumbnail");
             }
         }
 
@@ -242,47 +242,47 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction,
     } else {
         switch (result) {
             case (SAP_FT_TRANSFER_FAIL_CHANNEL_IO): {
-                LOGW("Channel IO Error.");
+                STLOGW("Channel IO Error.");
                 break;
             }
 
             case (SAP_FT_TRANSFER_FAIL_FILE_IO): {
-                LOGW("File IO Error.");
+                STLOGW("File IO Error.");
                 break;
             }
 
             case (SAP_FT_TRANSFER_FAIL_CMD_DROPPED):
             {
-                LOGW("Transfer dropped.");
+                STLOGW("Transfer dropped.");
                 break;
             }
 
             case (SAP_FT_TRANSFER_FAIL_PEER_UNRESPONSIVE):
             {
-                LOGW("Peer Un Responsive.");
+                STLOGW("Peer Un Responsive.");
                 break;
             }
 
             case (SAP_FT_TRANSFER_FAIL_PEER_CONN_LOST):
             {
-                LOGW("Connection Lost.");
+                STLOGW("Connection Lost.");
                 break;
             }
 
             case (SAP_FT_TRANSFER_FAIL_PEER_CANCELLED):
             {
-                LOGW("Peer Cancelled.");
+                STLOGW("Peer Cancelled.");
                 break;
             }
 
             case (SAP_FT_TRANSFER_FAIL_SPACE_NOT_AVAILABLE):
             {
-                LOGW("No Space.");
+                STLOGW("No Space.");
                 break;
             }
 
             default:
-                LOGW("Unknown Error");
+                STLOGW("Unknown Error");
                 break;
         }
     }
@@ -329,10 +329,10 @@ void accept_file()
     ret = sap_file_transfer_receive(priv_data.file_socket, file_path);
     switch(ret) {
         case SAP_RESULT_PERMISSION_DENIED:
-            LOGW("permission denied");
+            STLOGW("permission denied");
             break;
         case SAP_RESULT_FAILURE:
-            LOGW("Fail");
+            STLOGW("Fail");
             break;
         case SAP_RESULT_SUCCESS:
             LOGI("Success");
@@ -356,7 +356,7 @@ static int _create_thumbnail_directory()
         return 0;
 
     if (mkdir(thumb_path, 0755) == -1) {
-        LOGE("directory create error");
+        STLOGE("directory create error");
         return -1;
     }
 
@@ -384,12 +384,12 @@ bool request_sticker_data(const char *mode, const char *category, const char *ty
 
     j_object = json_object_new();
     if (j_object == NULL) {
-        LOGE("json object create error");
+        STLOGE("json object create error");
         return false;
     }
 
     if (_create_thumbnail_directory() != 0)
-        LOGE("Failed to create thumbnail directory");
+        STLOGE("Failed to create thumbnail directory");
 
     json_object_set_string_member(j_object, "msgId", STICKER_SYNC_START_REQ);
     json_object_set_int_member(j_object, "tID", ++t_id);
@@ -398,7 +398,7 @@ bool request_sticker_data(const char *mode, const char *category, const char *ty
     json_object_set_string_member(j_object, "type", type);
 
     if (_send_json_data(j_object) == FALSE) {
-        LOGE("Failed to send STICKER_SYNC_START_REQ");
+        STLOGE("Failed to send STICKER_SYNC_START_REQ");
         result = false;
     }
     else {
@@ -424,12 +424,12 @@ static bool process_request_queue()
 
     switch (request.req_type) {
         case REQUEST_TYPE_FEATURE_REQ:
-            LOGD("[Request feature exchange]");
+            STLOGD("[Request feature exchange]");
             request_sticker_feature();
             ReqQueue.pop();
             break;
         case REQUEST_TYPE_SYNC:
-            LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(),
+            STLOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(),
                     request.category.c_str(),
                     request.type.c_str());
 
@@ -438,12 +438,12 @@ static bool process_request_queue()
 
             break;
         case REQUEST_TYPE_SHOW_NOTIFICATION:
-            LOGD("[Request to show notification]");
+            STLOGD("[Request to show notification]");
             request_show_sync_notification();
             ReqQueue.pop();
             break;
         case REQUEST_TYPE_AUTOSYNC:
-            LOGD("[Request to sync automatically]");
+            STLOGD("[Request to sync automatically]");
             ReqQueue.pop();
             request_all_sticker_data("auto", "input");
             break;
@@ -456,7 +456,7 @@ static bool process_request_queue()
 
 void request_auto_sync()
 {
-    LOGD("Add request to sync automatically");
+    STLOGD("Add request to sync automatically");
     StickerRequest pending_request;
     pending_request.req_type = REQUEST_TYPE_AUTOSYNC;
     ReqQueue.push(pending_request);
@@ -484,7 +484,7 @@ void request_all_sticker_data(const char *mode, const char *type)
         }
     }
     else
-        LOGW("Failed to get value of VCONFKEY_STICKER_SUPPORTED_FEATURE");
+        STLOGW("Failed to get value of VCONFKEY_STICKER_SUPPORTED_FEATURE");
 #else
     pending_request.category = string("arsticker");
     ReqQueue.push(pending_request);
@@ -511,7 +511,7 @@ void request_sticker_feature()
 
     j_object = json_object_new();
     if (j_object == NULL) {
-        LOGE("json object create error");
+        STLOGE("json object create error");
         return;
     }
 
@@ -519,7 +519,7 @@ void request_sticker_feature()
     json_object_set_int_member(j_object, "tID", ++t_id);
 
     if (_send_json_data(j_object) == FALSE) {
-        LOGE("Failed to send STICKER_SYNC_FEATURE_REQ");
+        STLOGE("Failed to send STICKER_SYNC_FEATURE_REQ");
     }
     else {
         job_progress = TRUE;
@@ -528,7 +528,7 @@ void request_sticker_feature()
     json_object_unref(j_object);
 
     if (_create_thumbnail_directory() != 0)
-        LOGE("Failed to create thumbnail directory");
+        STLOGE("Failed to create thumbnail directory");
 }
 
 void send_disconnect_message()
@@ -536,7 +536,7 @@ void send_disconnect_message()
     JsonObject *j_object = NULL;
     j_object = json_object_new();
     if (j_object == NULL) {
-        LOGE("json object create error");
+        STLOGE("json object create error");
         return;
     }
 
@@ -544,7 +544,7 @@ void send_disconnect_message()
     json_object_set_int_member(j_object, "tID", t_id);
 
     if (_send_json_data(j_object) == FALSE) {
-        LOGE("Failed to send STICKER_SEND_DISCONNECT_REQ");
+        STLOGE("Failed to send STICKER_SEND_DISCONNECT_REQ");
     }
 
     json_object_unref(j_object);
@@ -565,7 +565,7 @@ void request_show_sync_notification()
 
     j_object = json_object_new();
     if (j_object == NULL) {
-        LOGE("json object create error");
+        STLOGE("json object create error");
         return;
     }
 
@@ -573,7 +573,7 @@ void request_show_sync_notification()
     json_object_set_int_member(j_object, "tID", ++t_id);
 
     if (_send_json_data(j_object) == FALSE) {
-        LOGE("Failed to send STICKER_REQUEST_NOTI_REQ");
+        STLOGE("Failed to send STICKER_REQUEST_NOTI_REQ");
     } else {
         job_progress = TRUE;
     }
@@ -619,16 +619,16 @@ void conn_terminated(sap_peer_agent_h peer_agent,
     switch (result)
     {
     case SAP_CONNECTION_TERMINATED_REASON_PEER_DISCONNECTED:
-        LOGW("Peer Disconnected");
+        STLOGW("Peer Disconnected");
         break;
     case SAP_CONNECTION_TERMINATED_REASON_DEVICE_DETACHED:
-        LOGW("Disconnected Device Detached");
+        STLOGW("Disconnected Device Detached");
         break;
     case SAP_CONNECTION_TERMINATED_REASON_UNKNOWN:
-        LOGW("Disconnected Unknown Reason");
+        STLOGW("Disconnected Unknown Reason");
         break;
     default:
-        LOGW("connection terminated. reason : %d", result);
+        STLOGW("connection terminated. reason : %d", result);
         break;
     }
 
@@ -668,7 +668,7 @@ static void send_sync_start_response(int result_code)
         {
             int is_synced = 0;
             if (vconf_get_int(VCONFKEY_STICKER_SYNC_COMPLETE, &is_synced) != 0)
-                LOGW("Failed to read sync completion");
+                STLOGW("Failed to read sync completion");
 
             if (is_synced == VCONFKEY_STICKER_SYNC_COMPLETE_NONE)
                 response_to_app = "no_sticker";
@@ -687,20 +687,20 @@ static void send_sync_start_response(int result_code)
             break;
     }
 
-    LOGD("result code : %d, sync complete flag : %d", result_code, sync_complete_flags);
+    STLOGD("result code : %d, sync complete flag : %d", result_code, sync_complete_flags);
 
 #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
     if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) != 0)
     {
-        LOGW("Failed to read support feature");
+        STLOGW("Failed to read support feature");
         return;
     }
 
-    LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
+    STLOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
     if (feature_flag == VCONFKEY_STICKER_FEATURE_AREMOJI ||
         feature_flag == VCONFKEY_STICKER_FEATURE_BITMOJI)
     {
-        LOGD("only standalone sync mode");
+        STLOGD("only standalone sync mode");
         send_message("sync_start_response", response_to_app.c_str());
     }
     else {
@@ -735,19 +735,19 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
 
     json_parser_load_from_data(parser, (char *)buffer, payload_length, &err_msg);
     if (err_msg) {
-        LOGE("failed to load json file. error message: %s", err_msg->message);
+        STLOGE("failed to load json file. error message: %s", err_msg->message);
         goto cleanup;
     }
 
     root = json_parser_get_root(parser);
     if (root == NULL) {
-        LOGE("failed to get root");
+        STLOGE("failed to get root");
         goto cleanup;
     }
 
     root_obj = json_node_get_object(root);
     if (root_obj == NULL) {
-        LOGE("failed to get object");
+        STLOGE("failed to get object");
         goto cleanup;
     }
 
@@ -756,7 +756,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
     if (msg_id == STICKER_REQUEST_SYNC_REQ) {
         request_all_sticker_data("manual", "input");
     } else if (msg_id == STICKER_SYNC_FEATURE_RSP) {
-        LOGD("msg : %s", msg_id.c_str());
+        STLOGD("msg : %s", msg_id.c_str());
 #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
         const char *json_aremoji = json_object_get_string_member(root_obj, "arEmoji");
         const char *json_bitmoji = json_object_get_string_member(root_obj, "bitmoji");
@@ -771,39 +771,39 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
             supported_feature |= VCONFKEY_STICKER_FEATURE_BITMOJI;
 
         if (vconf_set_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, supported_feature) == 0)
-            LOGD("Succeed to set supported feature");
+            STLOGD("Succeed to set supported feature");
         else
-            LOGW("Fail to set supported feature");
+            STLOGW("Fail to set supported feature");
 #else
-        LOGW("No vconf supported feature");
+        STLOGW("No vconf supported feature");
 #endif
 
         if (!process_request_queue()) {
             quit();
         }
     } else if (msg_id == STICKER_SYNC_START_RSP) {
-        LOGD("msg : %s", msg_id.c_str());
+        STLOGD("msg : %s", msg_id.c_str());
         const char *json_result = json_object_get_string_member(root_obj, "result");
         string result = string(json_result ? json_result : "");
         int result_code = json_object_get_int_member(root_obj, "resultCode");
-        LOGD("result : %s, resultCode : %d", result.c_str(), result_code);
+        STLOGD("result : %s, resultCode : %d", result.c_str(), result_code);
 
         if(result_code == SYNC_START_RSP_SUCCESS) {
             send_sync_start_response(result_code);
             if (current_request.category == string("bitmoji")) {
-                LOGD("Delete all bitmoji stickers");
+                STLOGD("Delete all bitmoji stickers");
                 delete_all_stickers("bitmoji");
             }
         } else if (result_code == SYNC_START_RSP_SYNC_AFTER_DELETING_AREMOJI) {
             send_sync_start_response(result_code);
-            LOGD("Delete all AR Emoji stickers");
+            STLOGD("Delete all AR Emoji stickers");
             delete_all_stickers("arsticker");
         } else {
             if (result_code == SYNC_START_RSP_BITMOJI_ALL_DELETE) {
-                LOGD("Delete all bitmoji stickers");
+                STLOGD("Delete all bitmoji stickers");
                 delete_all_stickers("bitmoji");
             } else if (result_code == SYNC_START_RSP_AREMOJI_ALL_DELETE) {
-                LOGD("Delete all AR Emoji stickers");
+                STLOGD("Delete all AR Emoji stickers");
                 delete_all_stickers("arsticker");
             }
 
@@ -813,7 +813,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
 
                 if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
                 {
-                    LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
+                    STLOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
                     if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI)
                     {
                         if (current_request.category == string("bitmoji"))
@@ -826,10 +826,10 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
                     }
                 }
                 else {
-                    LOGW("Failed to read support feature");
+                    STLOGW("Failed to read support feature");
                 }
 #else
-                LOGW("No vconf supported feature");
+                STLOGW("No vconf supported feature");
 #endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */
 
                 send_sync_start_response(result_code);
@@ -840,7 +840,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
             }
         }
     } else if (msg_id == STICKER_SEND_START_REQ) {
-        LOGD("msg : %s", msg_id.c_str());
+        STLOGD("msg : %s", msg_id.c_str());
         total_file_count_in_group = 0;
         rec_file_cnt_in_group = 0;
         t_id = json_object_get_int_member(root_obj, "tID");
@@ -854,7 +854,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
                 string file_name = string(json_filename ? json_filename : "");
 
                 if (file_len > 0) {
-                    LOGD("Add file : %s, len : %d", file_name.c_str(), file_len);
+                    STLOGD("Add file : %s, len : %d", file_name.c_str(), file_len);
                     total_file_count_in_group++;
                 } else {
                     char *app_id = NULL;
@@ -867,7 +867,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
                     snprintf(file_path, sizeof(file_path), "%s/%s", data_path, del_file_name.c_str());
                     snprintf(del_path, sizeof(del_path), "%s/%s%s",STICKER_DIRECTORY, app_id, file_path);
 
-                    LOGD("Delete file : %s, len : %d", del_path, file_len);
+                    STLOGD("Delete file : %s, len : %d", del_path, file_len);
                     delete_sticker_data(del_path);
 
                     if (app_id)
@@ -878,7 +878,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
 
         JsonObject *j_object = json_object_new();
         if (j_object == NULL) {
-            LOGE("Unable to json_object_new");
+            STLOGE("Unable to json_object_new");
             goto cleanup;
         }
 
@@ -887,11 +887,11 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
         json_object_set_string_member(j_object, "result", "success");
 
         if (_send_json_data(j_object) == FALSE)
-            LOGE("Failed to send message");
+            STLOGE("Failed to send message");
 
         json_object_unref(j_object);
     } else if (msg_id == STICKER_SEND_FACE_DATA) {
-        LOGD("msg : %s", msg_id.c_str());
+        STLOGD("msg : %s", msg_id.c_str());
         const char *type_data = json_object_get_string_member(root_obj, "type");
         if (type_data)
             sticker_data.disp_type = string(type_data);
@@ -902,14 +902,14 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
             sticker_data.keyword = string(category);
         }
     } else if (msg_id == STICKER_SEND_STOP_REQ) {
-        LOGD("msg : %s", msg_id.c_str());
+        STLOGD("msg : %s", msg_id.c_str());
         const char *json_reason = json_object_get_string_member(root_obj, "reason");
         string reason = string(json_reason ? json_reason : "");
         int file_len = json_object_get_int_member(root_obj, "count");
 
         JsonObject *j_object = json_object_new();
         if (j_object == NULL) {
-            LOGE("Unable to json_object_new");
+            STLOGE("Unable to json_object_new");
             goto cleanup;
         }
 
@@ -923,7 +923,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
 
                 if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
                 {
-                    LOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
+                    STLOGD("feature : %d, current request category : %s", feature_flag, current_request.category.c_str());
                     if (feature_flag == VCONFKEY_STICKER_FEATURE_AREMOJI)
                     {
                         if (current_request.category == string("arsticker"))
@@ -942,10 +942,10 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
                     }
                 }
                 else {
-                    LOGW("Failed to read support feature");
+                    STLOGW("Failed to read support feature");
                 }
 #else
-                LOGW("No vconf supported feature");
+                STLOGW("No vconf supported feature");
 #endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */
 
                 json_object_set_string_member(j_object, "result", "success");
@@ -960,7 +960,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
         }
 
         if (_send_json_data(j_object) == FALSE)
-            LOGE("Failed to send message");
+            STLOGE("Failed to send message");
 
         json_object_unref(j_object);
 
@@ -976,7 +976,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
             quit();
         }
     } else
-        LOGW("unknown msg id : %s", msg_id.c_str());
+        STLOGW("unknown msg id : %s", msg_id.c_str());
 
 cleanup:
     if (err_msg)
@@ -1005,25 +1005,25 @@ static void on_conn_req(sap_peer_agent_h peer_agent,
         LOGI("Connection Already Exist");
         break;
     case SAP_CONNECTION_FAILURE_DEVICE_UNREACHABLE:
-        LOGW("Connection failure device unreachable");
+        STLOGW("Connection failure device unreachable");
         break;
     case SAP_CONNECTION_FAILURE_INVALID_PEERAGENT:
-        LOGW("Connection failure invalid peer agent");
+        STLOGW("Connection failure invalid peer agent");
         break;
     case SAP_CONNECTION_FAILURE_NETWORK:
-        LOGW("Connection failure network");
+        STLOGW("Connection failure network");
         break;
     case SAP_CONNECTION_FAILURE_PEERAGENT_NO_RESPONSE:
-        LOGW("Connection failure peer agent no response");
+        STLOGW("Connection failure peer agent no response");
         break;
     case SAP_CONNECTION_FAILURE_PEERAGENT_REJECTED:
-        LOGW("Connection failure peer agent rejected");
+        STLOGW("Connection failure peer agent rejected");
         break;
     case SAP_CONNECTION_FAILURE_UNKNOWN:
-        LOGW("Connection failure unknown");
+        STLOGW("Connection failure unknown");
         break;
     default:
-        LOGW("Connection failure. error code : %d", result);
+        STLOGW("Connection failure. error code : %d", result);
         break;
     }
 }
@@ -1057,35 +1057,35 @@ _on_service_connection_created(sap_peer_agent_h peer_agent,
         break;
 
     case SAP_CONNECTION_FAILURE_DEVICE_UNREACHABLE:
-        LOGW("Connection Failure device unreachable");
+        STLOGW("Connection Failure device unreachable");
         break;
 
     case SAP_CONNECTION_FAILURE_INVALID_PEERAGENT:
-        LOGW("Connection Failure invalid peer agent");
+        STLOGW("Connection Failure invalid peer agent");
         break;
 
     case SAP_CONNECTION_FAILURE_NETWORK:
-        LOGW("Connection Failure network");
+        STLOGW("Connection Failure network");
         break;
 
     case SAP_CONNECTION_FAILURE_PEERAGENT_NO_RESPONSE:
-        LOGW("Connection Failure peer agent no response");
+        STLOGW("Connection Failure peer agent no response");
         break;
 
     case SAP_CONNECTION_FAILURE_PEERAGENT_REJECTED:
-        LOGW("Connection Failure peer agent rejected");
+        STLOGW("Connection Failure peer agent rejected");
         break;
 
     case SAP_CONNECTION_FAILURE_UNKNOWN:
-        LOGW("Connection Failure peer agent unknown");
+        STLOGW("Connection Failure peer agent unknown");
         break;
 
     case SAP_CONNECTION_IN_PROGRESS:
-        LOGW("Connection in progress");
+        STLOGW("Connection in progress");
         break;
 
     case SAP_CONNECTION_PEER_AGENT_NOT_SUPPORTED:
-        LOGW("Connection peer agent not supported");
+        STLOGW("Connection peer agent not supported");
         break;
     }
 }
@@ -1099,7 +1099,7 @@ _create_service_connection(gpointer user_data)
                                                       _on_service_connection_created,
                                                       priv);
 
-    LOGD("request connection result : %d", result);
+    STLOGD("request connection result : %d", result);
 
     return FALSE;
 }
@@ -1115,13 +1115,13 @@ _on_peer_agent_updated(sap_peer_agent_h peer_agent,
     switch (result)
     {
     case SAP_PEER_AGENT_FOUND_RESULT_DEVICE_NOT_CONNECTED:
-        LOGW("SAP_PEER_AGENT_FOUND_RESULT_DEVICE_NOT_CONNECTED");
+        STLOGW("SAP_PEER_AGENT_FOUND_RESULT_DEVICE_NOT_CONNECTED");
         break;
 
     case SAP_PEER_AGENT_FOUND_RESULT_FOUND:
         if (peer_status == SAP_PEER_AGENT_STATUS_AVAILABLE)
         {
-            LOGD("SAP_PEER_AGENT_FOUND_RESULT_FOUND");
+            STLOGD("SAP_PEER_AGENT_FOUND_RESULT_FOUND");
             priv->peer_agent = peer_agent;
             g_idle_add(_create_service_connection, priv);
         }
@@ -1132,15 +1132,15 @@ _on_peer_agent_updated(sap_peer_agent_h peer_agent,
         break;
 
     case SAP_PEER_AGENT_FOUND_RESULT_SERVICE_NOT_FOUND:
-        LOGW("SAP_PEER_AGENT_FOUND_RESULT_SERVICE_NOT_FOUND");
+        STLOGW("SAP_PEER_AGENT_FOUND_RESULT_SERVICE_NOT_FOUND");
         break;
 
     case SAP_PEER_AGENT_FOUND_RESULT_TIMEDOUT:
-        LOGW("SAP_PEER_AGENT_FOUND_RESULT_TIMEDOUT");
+        STLOGW("SAP_PEER_AGENT_FOUND_RESULT_TIMEDOUT");
         break;
 
     case SAP_PEER_AGENT_FOUND_RESULT_INTERNAL_ERROR:
-        LOGW("SAP_PEER_AGENT_FOUND_RESULT_INTERNAL_ERROR");
+        STLOGW("SAP_PEER_AGENT_FOUND_RESULT_INTERNAL_ERROR");
         break;
 
     default:
@@ -1163,7 +1163,7 @@ static void on_agent_initialized(sap_agent_h agent,
 {
     switch (result) {
         case SAP_AGENT_INITIALIZED_RESULT_SUCCESS:
-            LOGD("agent is initialized");
+            STLOGD("agent is initialized");
 
             priv_data.agent = agent;
 
@@ -1172,16 +1172,16 @@ static void on_agent_initialized(sap_agent_h agent,
 
             break;
         case SAP_AGENT_INITIALIZED_RESULT_DUPLICATED:
-            LOGE("duplicate registration");
+            STLOGE("duplicate registration");
             break;
         case SAP_AGENT_INITIALIZED_RESULT_INVALID_ARGUMENTS:
-            LOGE("invalid arguments");
+            STLOGE("invalid arguments");
             break;
         case SAP_AGENT_INITIALIZED_RESULT_INTERNAL_ERROR:
-            LOGE("internal sap error");
+            STLOGE("internal sap error");
             break;
         default:
-            LOGE("unknown status (%d)", result);
+            STLOGE("unknown status (%d)", result);
             break;
     }
 }
@@ -1190,47 +1190,47 @@ static void on_agent_deinitialized(sap_agent_h agent,
                                    sap_agent_deinitialized_result_e result,
                                    void *user_data)
 {
-    LOGD("result of deinitialize : %d", result);
+    STLOGD("result of deinitialize : %d", result);
 }
 
 static void _on_device_status_changed(sap_device_status_e status,
                                       sap_transport_type_e transport_type,
                                       void *user_data)
 {
-    LOGD("%s, status :%d", __func__, status);
+    STLOGD("%s, status :%d", __func__, status);
 
     switch (transport_type) {
         case SAP_TRANSPORT_TYPE_BT:
-            LOGD("transport_type (%d): bt", transport_type);
+            STLOGD("transport_type (%d): bt", transport_type);
             break;
         case SAP_TRANSPORT_TYPE_BLE:
-            LOGD("transport_type (%d): ble", transport_type);
+            STLOGD("transport_type (%d): ble", transport_type);
             break;
         case SAP_TRANSPORT_TYPE_TCP:
-            LOGD("transport_type (%d): tcp/ip", transport_type);
+            STLOGD("transport_type (%d): tcp/ip", transport_type);
             break;
         case SAP_TRANSPORT_TYPE_USB:
-            LOGD("transport_type (%d): usb", transport_type);
+            STLOGD("transport_type (%d): usb", transport_type);
             break;
         case SAP_TRANSPORT_TYPE_MOBILE:
-            LOGD("transport_type (%d): mobile", transport_type);
+            STLOGD("transport_type (%d): mobile", transport_type);
             break;
         default:
-            LOGE("unknown transport_type (%d)", transport_type);
+            STLOGE("unknown transport_type (%d)", transport_type);
             break;
     }
 
     switch (status) {
         case SAP_DEVICE_STATUS_DETACHED:
-            LOGD("device is not connected.");
+            STLOGD("device is not connected.");
             send_message("sync_stop_result", "cancel");
             break;
         case SAP_DEVICE_STATUS_ATTACHED:
-            LOGD("Attached calling find peer now");
+            STLOGD("Attached calling find peer now");
             g_idle_add(_find_peer_agent, &priv_data);
             break;
         default:
-            LOGE("unknown status (%d)", status);
+            STLOGE("unknown status (%d)", status);
             break;
     }
 }
@@ -1243,7 +1243,7 @@ gboolean agent_initialize()
         result = sap_agent_initialize(priv_data.agent, ACCESSORY_SERVICE_PROFILE_ID, SAP_AGENT_ROLE_CONSUMER,
                 on_agent_initialized, NULL);
 
-        LOGD("SAP >>> getRegisteredServiceAgent() >>> %d", result);
+        STLOGD("SAP >>> getRegisteredServiceAgent() >>> %d", result);
     } while (result != SAP_RESULT_SUCCESS);
 
     return TRUE;
@@ -1254,7 +1254,7 @@ gboolean initialize_sap(void)
     sap_agent_h agent = NULL;
 
     if (priv_data.agent) {
-        LOGW("duplicate initialize");
+        STLOGW("duplicate initialize");
         return FALSE;
     }
 
@@ -1271,21 +1271,21 @@ gboolean initialize_sap(void)
 
 void deinitialize_sap(void)
 {
-    LOGD("deinitialize");
+    STLOGD("deinitialize");
     if (priv_data.agent) {
         int ret = sap_agent_deinitialize(priv_data.agent, on_agent_deinitialized, NULL);
         switch (ret) {
             case SAP_RESULT_FAILURE:
-                LOGW("Failed to deinitialize");
+                STLOGW("Failed to deinitialize");
                 break;
             case SAP_RESULT_SUCCESS:
-                LOGD("Succeed to deinitialize");
+                STLOGD("Succeed to deinitialize");
                 break;
             case SAP_RESULT_PERMISSION_DENIED:
-                LOGW("permission denied: deinitialize ");
+                STLOGW("permission denied: deinitialize ");
                 break;
             default:
-                LOGD("deinitialize : %d", ret);
+                STLOGD("deinitialize : %d", ret);
                 break;
         }
 
index d8797dd..783ac2d 100644 (file)
@@ -47,7 +47,7 @@ static bool app_create(void *data)
         return true;
     }
 
-    LOGD("");
+    STLOGD("");
 
     char log_path[PATH_MAX];
     char *data_path = NULL;
@@ -59,7 +59,7 @@ static bool app_create(void *data)
 
     if (access(log_path, F_OK) != 0) {
         if (mkdir(log_path, 0755) == -1) {
-            LOGE("directory create error");
+            STLOGE("directory create error");
         }
     }
 
@@ -77,7 +77,7 @@ static bool check_battery_condition()
     ret = device_battery_get_percent(&battery_percentage);
     if (ret != DEVICE_ERROR_NONE)
     {
-        LOGW("No sync. Failed to get battery percent. error : %d", ret);
+        STLOGW("No sync. Failed to get battery percent. error : %d", ret);
         return false;
     }
 
@@ -103,16 +103,16 @@ static bool check_sync_time_condition()
     {
         if (preference_get_double(LAST_SYNC_TIME, &last_sync_time) != PREFERENCE_ERROR_NONE)
         {
-            LOGD("Can't get last sync time.");
+            STLOGD("Can't get last sync time.");
             return true;
         }
 
         // compare time
         double timediff = ecore_time_unix_get() - last_sync_time;
-        LOGD("current time : %.3f, last_sync_time : %.3f, diff : %.3f", ecore_time_unix_get(), last_sync_time, timediff);
+        STLOGD("current time : %.3f, last_sync_time : %.3f, diff : %.3f", ecore_time_unix_get(), last_sync_time, timediff);
 
         if (timediff > MAX_WAIT_TIME) {
-            LOGD("Starting manual synchronization");
+            STLOGD("Starting manual synchronization");
             initialize_sap();
             request_show_sync_notification();
             result = false;
@@ -169,7 +169,7 @@ static void app_control(app_control_h app_control, void *data)
     // operation
     int ret = app_control_get_operation(app_control, &operation);
     if (ret == APP_CONTROL_ERROR_NONE) {
-        LOGD("operation: %s", operation);
+        STLOGD("operation: %s", operation);
 
         if (!operation) {
             goto cleanup;
@@ -190,7 +190,7 @@ static void app_control(app_control_h app_control, void *data)
                             if (!is_init_sap()) {
                                 if (check_sync_time_condition()) {
                                     if (check_battery_condition()) {
-                                        LOGD("Starting auto synchronization");
+                                        STLOGD("Starting auto synchronization");
                                         initialize_sap();
                                         request_sticker_feature();
                                         request_auto_sync();
@@ -199,13 +199,13 @@ static void app_control(app_control_h app_control, void *data)
                                 else {
                                     if (!get_job_progress())
                                     {
-                                        LOGD("exit");
+                                        STLOGD("exit");
                                         service_app_exit();
                                     }
                                 }
                             }
                             else {
-                                LOGD("continue doing current job");
+                                STLOGD("continue doing current job");
                             }
                         }
                         free(event_value);
@@ -216,7 +216,7 @@ static void app_control(app_control_h app_control, void *data)
         }
     }
     else {
-        LOGW("Failed to get operation. error : %d", ret);
+        STLOGW("Failed to get operation. error : %d", ret);
     }
 
     // sync request
@@ -225,12 +225,12 @@ static void app_control(app_control_h app_control, void *data)
         if (strcmp(request, "sync") == 0) {
             bool param_error = false;
             if (app_control_get_extra_data(app_control, "mode", &mode) != APP_CONTROL_ERROR_NONE) {
-                LOGE("No given mode");
+                STLOGE("No given mode");
                 param_error = true;
             }
 
             if (app_control_get_extra_data(app_control, "type", &type) != APP_CONTROL_ERROR_NONE) {
-                LOGE("No given type");
+                STLOGE("No given type");
                 param_error = true;
             }
 
@@ -251,7 +251,7 @@ static void app_control(app_control_h app_control, void *data)
         }
         else
         {
-            LOGW("Unknown command : %s", request);
+            STLOGW("Unknown command : %s", request);
             if (!is_init_sap())
             {
                 service_app_exit();
@@ -276,7 +276,7 @@ cleanup:
 static void app_terminate(void *data)
 {
     /* Release all resources. */
-    LOGD("");
+    STLOGD("");
     destroy_sticker_provider_handle();
     deinitialize_sap();
 }
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
 
     ret = service_app_main(argc, argv, &event_callback, NULL);
     if (ret != APP_ERROR_NONE) {
-        LOGE("app_main() is failed. err = %d", ret);
+        STLOGE("app_main() is failed. err = %d", ret);
     }
     return ret;
 }
index 80b69da..0abac07 100644 (file)
@@ -36,7 +36,7 @@ bool send_message(const char *cmd, const char *data)
     ret = event_publish_app_event(EVENT_NAME, b);
     if (ret != EVENT_ERROR_NONE) {
         result = false;
-        LOGE("Failed to send message by event publish. error : %d", ret);
+        STLOGE("Failed to send message by event publish. error : %d", ret);
     }
     else
     {
index 650d880..435d507 100644 (file)
@@ -35,14 +35,14 @@ int len, const char* group, const char* thumbnail, const char* description, stic
     ret = sticker_data_create(&sticker_data);
     if (ret != STICKER_ERROR_NONE) {
         /* Error handling */
-        LOGE("Failed to create sticker data");
+        STLOGE("Failed to create sticker data");
     }
 
     /* Sets the URI and URI type of the sticker */
     ret = sticker_data_set_uri(sticker_data, type, uri);
     if (ret != STICKER_ERROR_NONE) {
         /* Error handling */
-        LOGE("Failed to set uri");
+        STLOGE("Failed to set uri");
     }
 
     //for (int i = 0; i < len; i++)
@@ -51,7 +51,7 @@ int len, const char* group, const char* thumbnail, const char* description, stic
         ret = sticker_data_add_keyword(sticker_data, keyword);
         if (ret != STICKER_ERROR_NONE) {
             /* Error handling */
-            LOGE("Failed to add keyword");
+            STLOGE("Failed to add keyword");
         }
     }
 
@@ -59,7 +59,7 @@ int len, const char* group, const char* thumbnail, const char* description, stic
     ret = sticker_data_set_group_name(sticker_data, group);
     if (ret != STICKER_ERROR_NONE) {
         /* Error handling */
-        LOGE("Failed to set group name");
+        STLOGE("Failed to set group name");
     }
 
     /* Sets the thumbnail local path of the sticker */
@@ -67,7 +67,7 @@ int len, const char* group, const char* thumbnail, const char* description, stic
         ret = sticker_data_set_thumbnail(sticker_data, thumbnail);
         if (ret != STICKER_ERROR_NONE) {
             /* Error handling */
-            LOGE("Failed to set thumbnail");
+            STLOGE("Failed to set thumbnail");
         }
     }
 
@@ -75,14 +75,14 @@ int len, const char* group, const char* thumbnail, const char* description, stic
     ret = sticker_data_set_description(sticker_data, description);
     if (ret != STICKER_ERROR_NONE) {
         /* Error handling */
-        LOGE("Failed to set description");
+        STLOGE("Failed to set description");
     }
 
     /* Sets the display type of the sticker.*/
     ret = sticker_data_set_display_type(sticker_data, disp_type);
     if (ret != STICKER_ERROR_NONE) {
         /* Error handling */
-        LOGE("Failed to set display type");
+        STLOGE("Failed to set display type");
     }
 
     return sticker_data;
@@ -104,7 +104,7 @@ insert_sticker_data(const char *filepath, const char *keyword, const char *group
 
     ret = sticker_provider_insert_data(sticker_provider, data_handle);
     if (ret != STICKER_ERROR_NONE) {
-        LOGE("Failed to insert data. error code : %x. message : %s", ret, get_error_message(ret));
+        STLOGE("Failed to insert data. error code : %x. message : %s", ret, get_error_message(ret));
     }
     else {
         LOGI("Succeeded to insert data");
@@ -114,7 +114,7 @@ insert_sticker_data(const char *filepath, const char *keyword, const char *group
     ret = sticker_data_destroy(data_handle);
     if (ret != STICKER_ERROR_NONE) {
         /* Error handling */
-        LOGE("Failed to destroy sticker data");
+        STLOGE("Failed to destroy sticker data");
     }
 }
 
@@ -124,7 +124,7 @@ void create_sticker_provider_handle(void)
     ret = sticker_provider_create(&sticker_provider);
     if (ret != STICKER_ERROR_NONE) {
         /* Error handling */
-        LOGE("Failed to create sticker provider. ret : %d", ret);
+        STLOGE("Failed to create sticker provider. ret : %d", ret);
     }
 }
 
@@ -139,7 +139,7 @@ void delete_sticker_data(const char *fileName)
     int ret;
     ret = sticker_provider_delete_data_by_uri(sticker_provider, fileName);
     if (ret != STICKER_ERROR_NONE)
-        LOGE("Failed to delete sticker. ret : %d", ret);
+        STLOGE("Failed to delete sticker. ret : %d", ret);
 }
 
 static void _delete_all_stickers_cb(sticker_data_h data_handle, void *user_data)
@@ -150,12 +150,12 @@ static void _delete_all_stickers_cb(sticker_data_h data_handle, void *user_data)
 
     ret = sticker_data_get_group_name(data_handle, &sticker_group);
     if (ret != STICKER_ERROR_NONE)
-        LOGE("Failed to get group name. ret : %d", ret);
+        STLOGE("Failed to get group name. ret : %d", ret);
 
     if (strcmp(sticker_group, del_group) == 0) {
         ret = sticker_provider_delete_data(sticker_provider, data_handle);
         if (ret != STICKER_ERROR_NONE)
-            LOGE("Failed to delete sticker. ret : %d", ret);
+            STLOGE("Failed to delete sticker. ret : %d", ret);
     }
 }
 
@@ -167,9 +167,9 @@ void delete_all_stickers(const char *groupName)
 
     ret = sticker_provider_get_sticker_count(sticker_provider, &total_cnt);
     if (ret != STICKER_ERROR_NONE)
-        LOGE("Failed to get sticker count. ret : %d", ret);
+        STLOGE("Failed to get sticker count. ret : %d", ret);
 
     ret = sticker_provider_data_foreach_all(sticker_provider, 0, total_cnt, &result, _delete_all_stickers_cb, (void *)groupName);
     if (ret != STICKER_ERROR_NONE)
-        LOGE("Failed to retrieve all sticker data. ret : %d", ret);
+        STLOGE("Failed to retrieve all sticker data. ret : %d", ret);
 }
\ No newline at end of file