From ca9bef2ffb4941f9f2aac9a1550f5ea3b2e096f1 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Tue, 17 Jan 2017 11:03:27 +0900 Subject: [PATCH] Update log level for information Change-Id: I1b3c72229727c6042b5ff5a202486c40f1c7f779 Signed-off-by: Wonnam Jang --- client/tts.c | 32 ++++++++++++++--------------- server/ttsd_engine_agent.c | 51 ++++++++++++++++++++++++---------------------- server/ttsd_server.c | 47 +++++++++++++++++++++++++++--------------- 3 files changed, 74 insertions(+), 56 deletions(-) diff --git a/client/tts.c b/client/tts.c index 86953fe..ac1ad4f 100644 --- a/client/tts.c +++ b/client/tts.c @@ -194,7 +194,7 @@ int tts_create(tts_h* tts) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Create TTS"); + SLOG(LOG_INFO, TAG_TTSC, "===== Create TTS"); /* check param */ if (NULL == tts) { @@ -248,7 +248,7 @@ int tts_destroy(tts_h tts) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Destroy TTS"); + SLOG(LOG_INFO, TAG_TTSC, "===== Destroy TTS"); if (NULL == tts) { SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null"); @@ -343,7 +343,7 @@ int tts_set_mode(tts_h tts, tts_mode_e mode) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Set TTS mode"); + SLOG(LOG_INFO, TAG_TTSC, "===== Set TTS mode(%d)", mode); tts_client_s* client = tts_client_get(tts); @@ -558,7 +558,7 @@ static Eina_Bool __tts_connect_daemon(void *data) return EINA_TRUE; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Connect daemon"); + SLOG(LOG_INFO, TAG_TTSC, "===== Connect daemon"); /* do request initialize */ int ret = -1; @@ -618,7 +618,7 @@ int tts_prepare(tts_h tts) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Prepare TTS"); + SLOG(LOG_INFO, TAG_TTSC, "===== Prepare TTS"); tts_client_s* client = tts_client_get(tts); @@ -652,7 +652,7 @@ int tts_unprepare(tts_h tts) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Unprepare TTS"); + SLOG(LOG_INFO, TAG_TTSC, "===== Unprepare TTS"); tts_client_s* client = tts_client_get(tts); @@ -941,7 +941,7 @@ int tts_get_error_message(tts_h tts, char** err_msg) int tts_add_text(tts_h tts, const char* text, const char* language, int voice_type, int speed, int* utt_id) { - SLOG(LOG_DEBUG, TAG_TTSC, "[DEBUG] Add text: text(%s), language(%s), type(%d)", (NULL == text) ? "NULL" : text, (NULL == language) ? "NULL" : language, voice_type); + SLOG(LOG_INFO, TAG_TTSC, "[DEBUG] Add text: text(%s), language(%s), type(%d)", (NULL == text) ? "NULL" : text, (NULL == language) ? "NULL" : language, voice_type); if (0 != __tts_get_feature_enabled()) { return TTS_ERROR_NOT_SUPPORTED; @@ -1190,7 +1190,7 @@ int tts_play(tts_h tts) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Play tts"); + SLOG(LOG_INFO, TAG_TTSC, "===== Play tts"); if (NULL == tts) { SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null."); @@ -1364,7 +1364,7 @@ int tts_stop(tts_h tts) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Stop tts"); + SLOG(LOG_INFO, TAG_TTSC, "===== Stop tts"); if (NULL == tts) { SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null"); @@ -1535,7 +1535,7 @@ int tts_pause(tts_h tts) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Pause tts"); + SLOG(LOG_INFO, TAG_TTSC, "===== Pause tts"); if (NULL == tts) { SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null"); @@ -1607,10 +1607,10 @@ int tts_set_private_data(tts_h tts, const char* key, const char* data) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Set private data"); + SLOG(LOG_INFO, TAG_TTSC, "===== Set private data, key(%s), data(%s)", key, data); if (NULL == tts) { - SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null"); + SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle isnull"); return TTS_ERROR_INVALID_PARAMETER; } @@ -1668,7 +1668,7 @@ int tts_get_private_data(tts_h tts, const char* key, char** data) return TTS_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_TTSC, "===== Get private data"); + SLOG(LOG_INFO, TAG_TTSC, "===== Get private data, key(%s)", key); if (NULL == tts) { SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null"); @@ -1893,7 +1893,7 @@ int __tts_cb_utt_started(int uid, int utt_id) return TTS_ERROR_INVALID_PARAMETER; } - SLOG(LOG_DEBUG, TAG_TTSC, "utterance started : utt id(%d) ", utt_id); + SLOG(LOG_INFO, TAG_TTSC, "utterance started : utt id(%d) ", utt_id); client->utt_id = utt_id; @@ -1919,7 +1919,7 @@ int __tts_cb_utt_completed(int uid, int utt_id) return TTS_ERROR_INVALID_PARAMETER; } - SLOG(LOG_DEBUG, TAG_TTSC, "utterance completed : uttid(%d) ", utt_id); + SLOG(LOG_INFO, TAG_TTSC, "utterance completed : uttid(%d) ", utt_id); client->utt_id = utt_id; @@ -1962,7 +1962,7 @@ int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* use client->state_changed_cb = callback; client->state_changed_user_data = user_data; - SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set state changed cb"); + SLOG(LOG_INFO, TAG_TTSC, "[SUCCESS] Set state changed cb"); return 0; } diff --git a/server/ttsd_engine_agent.c b/server/ttsd_engine_agent.c index bf26f9c..684a90f 100644 --- a/server/ttsd_engine_agent.c +++ b/server/ttsd_engine_agent.c @@ -675,14 +675,14 @@ int ttsd_engine_agent_set_default_voice(const char* language, int vctype) if (0 == data->client_ref_count) { /* Unload voice */ ret = g_engine_info->callbacks->unload_voice(data->lang, data->type); - if (0 == ret) { + if (0 == ret) { SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent SUCCESS] Unload voice : lang(%s), type(%d)", - data->lang, data->type); - data->is_loaded = false; - } else { + data->lang, data->type); + data->is_loaded = false; + } else { SECURE_SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to unload voice : lang(%s), type(%d), result(%s)", - data->lang, data->type, __ttsd_get_engine_error_code(ret)); - } + data->lang, data->type, __ttsd_get_engine_error_code(ret)); + } } break; } @@ -744,6 +744,7 @@ int ttsd_engine_agent_set_default_pitch(int pitch) g_engine_info->default_pitch = pitch; + SLOG(LOG_INFO, tts_tag(), "[Engine Agent] Set pitch(%d)", pitch); return 0; } @@ -773,6 +774,7 @@ int ttsd_engine_agent_is_credential_needed(int uid, bool* credential_needed) result = g_engine_info->callbacks->need_app_credential(); *credential_needed = result; + SLOG(LOG_INFO, tts_tag(), "[Engine Agent] Need app credential, credential_needed(%d)", *credential_needed); return TTSD_ERROR_NONE; } @@ -832,19 +834,19 @@ int ttsd_engine_load_voice(const char* lang, const int vctype) if (1 == data->client_ref_count && false == data->is_default) { /* load voice */ ret = g_engine_info->callbacks->load_voice(data->lang, data->type); - if (0 == ret) { + if (0 == ret) { SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent SUCCESS] Load voice : lang(%s), type(%d)", - data->lang, data->type); - data->is_loaded = true; - } else { + data->lang, data->type); + data->is_loaded = true; + } else { SECURE_SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to load voice : lang(%s), type(%d), result(%s)", - data->lang, data->type, __ttsd_get_engine_error_code(ret)); + data->lang, data->type, __ttsd_get_engine_error_code(ret)); - return TTSD_ERROR_OPERATION_FAILED; - } - } else { + return TTSD_ERROR_OPERATION_FAILED; + } + } else { SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Not load voice : default voice(%d) or ref count(%d)", - data->is_default, data->client_ref_count); + data->is_default, data->client_ref_count); } #ifdef ENGINE_AGENT_DEBUG @@ -906,19 +908,19 @@ int ttsd_engine_unload_voice(const char* lang, const int vctype) if (0 == data->client_ref_count && false == data->is_default) { /* unload voice */ ret = g_engine_info->callbacks->unload_voice(data->lang, data->type); - if (0 == ret) { + if (0 == ret) { SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent SUCCESS] Unload voice : lang(%s), type(%d)", - data->lang, data->type); - data->is_loaded = false; - } else { + data->lang, data->type); + data->is_loaded = false; + } else { SECURE_SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to unload voice : lang(%s), type(%d), result(%s)", - data->lang, data->type, __ttsd_get_engine_error_code(ret)); + data->lang, data->type, __ttsd_get_engine_error_code(ret)); - return TTSD_ERROR_OPERATION_FAILED; - } - } else { + return TTSD_ERROR_OPERATION_FAILED; + } + } else { SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Engine Agent] Not unload voice : default voice(%d) or ref count(%d)", - data->is_default, data->client_ref_count); + data->is_default, data->client_ref_count); } #ifdef ENGINE_AGENT_DEBUG @@ -997,6 +999,7 @@ int ttsd_engine_cancel_synthesis() return TTSD_ERROR_ENGINE_NOT_FOUND; } + SLOG(LOG_INFO, tts_tag(), "[Engine Agent] Cancel synth"); /* stop synthesis */ int ret = 0; ret = g_engine_info->callbacks->cancel_synth(); diff --git a/server/ttsd_server.c b/server/ttsd_server.c index 9064378..c591050 100644 --- a/server/ttsd_server.c +++ b/server/ttsd_server.c @@ -93,6 +93,7 @@ static int __synthesis(int uid, const char* credential) speak_data_s* speak_data = NULL; if (0 == ttsd_data_get_speak_data(uid, &speak_data)) { if (NULL == speak_data) { + SLOG(LOG_WARN, tts_tag(), "[Server] speak data is null"); return 0; } @@ -125,12 +126,12 @@ static int __synthesis(int uid, const char* credential) g_utt.uid = uid; g_utt.uttid = speak_data->utt_id; - SLOG(LOG_DEBUG, tts_tag(), "-----------------------------------------------------------"); - SECURE_SLOG(LOG_DEBUG, tts_tag(), "ID : uid (%d), uttid(%d) ", g_utt.uid, g_utt.uttid); - SECURE_SLOG(LOG_DEBUG, tts_tag(), "Voice : langauge(%s), type(%d), speed(%d)", speak_data->lang, speak_data->vctype, speak_data->speed); - SECURE_SLOG(LOG_DEBUG, tts_tag(), "Text : %s", speak_data->text); - SECURE_SLOG(LOG_DEBUG, tts_tag(), "Credential : %s", credential); - SLOG(LOG_DEBUG, tts_tag(), "-----------------------------------------------------------"); + SLOG(LOG_INFO, tts_tag(), "-----------------------------------------------------------"); + SLOG(LOG_INFO, tts_tag(), "ID : uid (%d), uttid(%d) ", g_utt.uid, g_utt.uttid); + SLOG(LOG_INFO, tts_tag(), "Voice : langauge(%s), type(%d), speed(%d)", speak_data->lang, speak_data->vctype, speak_data->speed); + SLOG(LOG_INFO, tts_tag(), "Text : %s", speak_data->text); + SLOG(LOG_INFO, tts_tag(), "Credential : %s", credential); + SLOG(LOG_INFO, tts_tag(), "-----------------------------------------------------------"); int ret = 0; __server_set_synth_control(TTSD_SYNTHESIS_CONTROL_DOING); @@ -208,11 +209,11 @@ int ttsd_send_result(ttse_result_event_e event, const void* data, unsigned int d /* Synthesis is success */ if (TTSE_RESULT_EVENT_START == event || TTSE_RESULT_EVENT_CONTINUE == event || TTSE_RESULT_EVENT_FINISH == event) { if (TTSE_RESULT_EVENT_START == event) { - SLOG(LOG_DEBUG, tts_tag(), "[SERVER] Event : TTSE_RESULT_EVENT_START"); + SLOG(LOG_INFO, tts_tag(), "[SERVER] Event : TTSE_RESULT_EVENT_START"); SECURE_SLOG(LOG_DEBUG, tts_tag(), "[SERVER] Result Info : uid(%d), utt(%d), data(%p), data size(%d) audiotype(%d) rate(%d)", uid, uttid, data, data_size, audio_type, rate); } else if (TTSE_RESULT_EVENT_FINISH == event) { - SLOG(LOG_DEBUG, tts_tag(), "[SERVER] Event : TTSE_RESULT_EVENT_FINISH"); + SLOG(LOG_INFO, tts_tag(), "[SERVER] Event : TTSE_RESULT_EVENT_FINISH"); SECURE_SLOG(LOG_DEBUG, tts_tag(), "[SERVER] Result Info : uid(%d), utt(%d), data(%p), data size(%d) audiotype(%d) rate(%d)", uid, uttid, data, data_size, audio_type, rate); } else { @@ -253,7 +254,7 @@ int ttsd_send_result(ttse_result_event_e event, const void* data, unsigned int d if (NULL != temp_sound_data->data) { memcpy(temp_sound_data->data, data, data_size); temp_sound_data->data_size = data_size; - SLOG(LOG_ERROR, tts_tag(), "[DEBUG][free] uid(%d), event(%d) sound_data(%p) data(%p) size(%d)", + SLOG(LOG_INFO, tts_tag(), "[DEBUG][memcpy] uid(%d), event(%d) sound_data(%p) data(%p) size(%d)", uid, event, temp_sound_data, temp_sound_data->data, temp_sound_data->data_size); } else { SLOG(LOG_ERROR, tts_tag(), "Fail to allocate memory"); @@ -405,7 +406,7 @@ void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_ bool __terminate_client(int pid, int uid, app_state_e state, void* user_data) { - SLOG(LOG_DEBUG, tts_tag(), "=== Start to terminate client [%d] ===", uid); + SLOG(LOG_INFO, tts_tag(), "=== Start to terminate client [%d] ===", uid); ttsd_server_finalize(uid); return true; } @@ -419,7 +420,7 @@ Eina_Bool ttsd_terminate_daemon(void *data) void __screen_reader_changed_cb(bool value) { if (TTSD_MODE_SCREEN_READER == ttsd_get_mode() && false == value) { - SLOG(LOG_DEBUG, tts_tag(), "[Server] Screen reader is OFF. Start to terminate tts daemon"); + SLOG(LOG_INFO, tts_tag(), "[Server] Screen reader is OFF. Start to terminate tts daemon"); ecore_timer_add(1, ttsd_terminate_daemon, NULL); } else { SLOG(LOG_DEBUG, tts_tag(), "[Server] Screen reader is %s", value ? "ON" : "OFF"); @@ -432,6 +433,8 @@ void __screen_reader_changed_cb(bool value) */ int ttsd_initialize(ttse_request_callback_s *callback) { + SLOG(LOG_INFO, tts_tag(), "[Server] Initialize"); + if (ttsd_config_initialize(__config_changed_cb)) { SLOG(LOG_ERROR, tts_tag(), "[Server WARNING] Fail to initialize config."); } @@ -471,6 +474,8 @@ int ttsd_initialize(ttse_request_callback_s *callback) int ttsd_finalize() { + SLOG(LOG_INFO, tts_tag(), "[Server] Finalize"); + GList *iter = NULL; if (0 < g_list_length(g_proc_list)) { iter = g_list_first(g_proc_list); @@ -496,6 +501,8 @@ int ttsd_finalize() int ttsd_server_initialize(int pid, int uid, bool* credential_needed) { + SLOG(LOG_INFO, tts_tag(), "[Server] Server initialize"); + if (-1 != ttsd_data_is_client(uid)) { SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Uid has already been registered"); return TTSD_ERROR_NONE; @@ -626,8 +633,8 @@ Eina_Bool ttsd_cleanup_client(void *data) __read_proc(); if (0 < ttsd_data_get_client_count()) { - ttsd_data_foreach_clients(__get_client_for_clean_up, NULL); - } else { + ttsd_data_foreach_clients(__get_client_for_clean_up, NULL); + } else { ecore_timer_add(0, __quit_ecore_loop, NULL); } @@ -647,6 +654,8 @@ void __used_voice_cb(const char* lang, int type) int ttsd_server_finalize(int uid) { + SLOG(LOG_INFO, tts_tag(), "[Server] Server finalize"); + app_state_e state; if (0 > ttsd_data_get_client_state(uid, &state)) { SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_finalize : uid is not valid"); @@ -712,6 +721,8 @@ int ttsd_server_add_queue(int uid, const char* text, const char* lang, int voice speak_data->text = strdup(text); + SLOG(LOG_INFO, tts_tag(), "[Server] Add queue, lang(%s), vctype(%d), speed(%d), uttid(%d), credential(%s)", lang, voice_type, speed, utt_id, credential); + /* if state is APP_STATE_READY , APP_STATE_PAUSED , only need to add speak data to queue*/ if (0 != ttsd_data_add_speak_data(uid, speak_data)) { SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to add speak data"); @@ -799,7 +810,7 @@ int ttsd_server_play(int uid, const char* credential) } int current_uid = ttsd_data_get_current_playing(); - SLOG(LOG_ERROR, tts_tag(), "[Server] playing uid (%d)", current_uid); + SLOG(LOG_INFO, tts_tag(), "[Server] playing uid (%d)", current_uid); if (uid != current_uid && -1 != current_uid) { if (TTSD_MODE_DEFAULT != ttsd_get_mode()) { @@ -869,6 +880,8 @@ int ttsd_server_stop(int uid) return TTSD_ERROR_INVALID_PARAMETER; } + SLOG(LOG_INFO, tts_tag(), "[Server] server stop, state(%d)", state); + if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state) { if (TTSD_SYNTHESIS_CONTROL_DOING == __server_get_synth_control()) { SLOG(LOG_DEBUG, tts_tag(), "[Server] TTS-engine is running"); @@ -906,6 +919,8 @@ int ttsd_server_pause(int uid, int* utt_id) return TTSD_ERROR_INVALID_STATE; } + SLOG(LOG_INFO, tts_tag(), "[Server] server pause, uid(%d), utt_id(%d)", uid, utt_id); + int ret = 0; ret = ttsd_player_pause(uid); if (0 != ret) { @@ -975,7 +990,7 @@ int ttsd_server_set_private_data(int uid, const char* key, const char* data) if (0 != ret) { SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to set private data : ret(%d)", ret); } else { - SLOG(LOG_DEBUG, tts_tag(), "[Server] Set private data"); + SLOG(LOG_DEBUG, tts_tag(), "[Server] Set private data, key(%s), data(%s)", key, data); } return ret; @@ -998,7 +1013,7 @@ int ttsd_server_get_private_data(int uid, const char* key, char** data) if (0 != ret) { SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get private data : ret(%d)", ret); } else { - SLOG(LOG_DEBUG, tts_tag(), "[Server] Get private data"); + SLOG(LOG_DEBUG, tts_tag(), "[Server] Get private data, key(%s), data(%s)", key, *data); } return ret; -- 2.7.4