Add log messages for checking startup process 50/234250/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 21 May 2020 07:49:49 +0000 (16:49 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Mon, 25 May 2020 00:12:55 +0000 (09:12 +0900)
Change-Id: I79a0d20bed3ee46f81e8a6b30f6df821c5838f13

src/multi_assistant_service.c

index fcbd186..a449555 100644 (file)
@@ -65,6 +65,26 @@ static ma_voice_key_status_e g_last_voice_key_status = MA_VOICE_KEY_STATUS_RELEA
 /* client list */
 static GSList* g_client_list = NULL;
 
+#ifdef ENABLE_FILE_LOG
+static void file_log(const char* s)
+{
+       FILE *fp = fopen("/tmp/maservice_log.txt", "a");
+       if (fp) {
+               char time_buf[96] = {0};
+
+               struct timespec ts;
+               clock_gettime(CLOCK_REALTIME, &ts);
+               const time_t tt = ts.tv_sec;
+               struct tm *const ptm = localtime(&tt);
+
+               strftime(time_buf, sizeof(time_buf), "%m-%d %H:%M:%S", ptm);
+               fprintf(fp, "[%s] %s\n", time_buf, s);
+               fclose(fp);
+       }
+       fflush(fp);
+}
+#endif
+
 int ma_client_create(ma_client_s *info)
 {
        if (NULL == info) {
@@ -1505,8 +1525,10 @@ static void _package_manager_event_cb(const char *type, const char *package, pac
 bool service_app_create(void *data)
 {
        // Todo: add your code here.
-
-       MAS_LOGD("[Enter] Service app create");
+       MAS_LOGI("[ENTER] Service app create");
+#ifdef ENABLE_FILE_LOG
+       file_log("[ENTER] Service app create");
+#endif
 
        if (0 != init_wakeup()) {
                MAS_LOGE("Fail to init wakeup service");
@@ -1529,6 +1551,10 @@ bool service_app_create(void *data)
                }
        }
 
+#ifdef ENABLE_FILE_LOG
+       file_log("[END] Service app create");
+#endif
+       MAS_LOGI("[END] Service app create");
        return true;
 }
 
@@ -1580,6 +1606,11 @@ service_app_low_memory(app_event_info_h event_info, void *user_data)
 
 int main(int argc, char* argv[])
 {
+       LOGI("Main function starts");
+#ifdef ENABLE_FILE_LOG
+       file_log("Main function starts");
+#endif
+
        char ad[50] = {0,};
        service_app_lifecycle_callback_s event_callback;
        app_event_handler_h handlers[5] = {NULL, };