From b1853d058f31645eedb6d3f3f3bd132334d29ddb Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 3 Jan 2020 19:48:35 +0900 Subject: [PATCH] Refine log levels and messages for better analysis Change-Id: I2bd416bc73b029792ed726ca59ece7f6e2b530bf --- plugins/wakeup-manager/inc/wakeup_manager_main.h | 2 +- .../wakeup-manager/src/wakeup_audio_manager.cpp | 13 ++++---- .../wakeup-manager/src/wakeup_engine_manager.cpp | 14 ++++---- plugins/wakeup-manager/src/wakeup_manager.cpp | 3 +- src/multi_assistant_dbus.c | 16 ++++----- src/multi_assistant_dbus_server.c | 38 +++++++++++----------- 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/plugins/wakeup-manager/inc/wakeup_manager_main.h b/plugins/wakeup-manager/inc/wakeup_manager_main.h index 80ce706..0a654c8 100644 --- a/plugins/wakeup-manager/inc/wakeup_manager_main.h +++ b/plugins/wakeup-manager/inc/wakeup_manager_main.h @@ -12,7 +12,7 @@ extern "C" { #ifdef LOG_TAG #undef LOG_TAG #endif -#define LOG_TAG "wakeup-manager" +#define LOG_TAG "multi-assistant" #ifdef __MODULE__ #undef __MODULE__ diff --git a/plugins/wakeup-manager/src/wakeup_audio_manager.cpp b/plugins/wakeup-manager/src/wakeup_audio_manager.cpp index 6a76a4f..efefeae 100644 --- a/plugins/wakeup-manager/src/wakeup_audio_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_audio_manager.cpp @@ -166,7 +166,7 @@ void CAudioManager::set_recording_session(recording_session session) /* Need to consider adapting conventional producer-consumer model */ void CAudioManager::streaming_previous_audio_data_thread_func() { - MWR_LOGD("[ENTER]"); + MWR_LOGI("[ENTER]"); unique_lock lock(mMutex, defer_lock); @@ -200,12 +200,12 @@ void CAudioManager::streaming_previous_audio_data_thread_func() } lock.unlock(); - MWR_LOGD("[EXIT]"); + MWR_LOGI("[EXIT]"); } void CAudioManager::streaming_audio_data_thread_func(long start_time) { - MWR_LOGD("[ENTER]"); + MWR_LOGI("[ENTER]"); unique_lock lock(mMutex, defer_lock); bool finish_event_sent = false; @@ -247,7 +247,7 @@ void CAudioManager::streaming_audio_data_thread_func(long start_time) advance(lead, 1); } if (lead != end) { - MWR_LOGI("[INFO] Resume thread"); + MWR_LOGD("[INFO] Resume thread"); break; } if (g_speech_pcm_wait_count < cnt) { @@ -265,12 +265,11 @@ void CAudioManager::streaming_audio_data_thread_func(long start_time) } } } - MWR_LOGD("[EXIT]"); return; } cnt++; } - MWR_LOGI("[INFO] Finish to wait for new feedback data come"); + MWR_LOGD("[INFO] Finish to wait for new feedback data come"); /* resume feedback thread */ continue; @@ -310,7 +309,7 @@ void CAudioManager::streaming_audio_data_thread_func(long start_time) } } } - MWR_LOGD("[EXIT]"); + MWR_LOGI("[EXIT]"); } void CAudioManager::add_audio_data(mas_speech_data& data, long time) diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index f374d58..01372c7 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -185,7 +185,7 @@ bool CWakeupEngineManager::set_assistant_language(string appid, string language) if (info.assistant_list.end() != iter) { try { int ret = info.interface.set_language(language.c_str()); - MWR_LOGD("set_language returned %d : %s %s %s", + MWR_LOGI("set_language returned %d : %s %s %s", ret, appid.c_str(), info.engine_name.c_str(), language.c_str()); } catch (const std::exception& e) { MWR_LOGE("[ERROR] wakeup engine %s threw exception : %s", @@ -198,7 +198,7 @@ bool CWakeupEngineManager::set_assistant_language(string appid, string language) void CWakeupEngineManager::set_assistant_activated(string appid, bool activated) { - MWR_LOGD("[ENTER] : %s %d", appid.c_str(), activated); + MWR_LOGI("[ENTER] : %s %d", appid.c_str(), activated); for (auto& info : mEngineInfo) { const auto& iter = find_if(info.assistant_list.begin(), info.assistant_list.end(), [appid](const string& assistant) { @@ -255,7 +255,7 @@ void CWakeupEngineManager::set_wake_word_audio_require_flag(bool require) void CWakeupEngineManager::streaming_speech_data_thread_func() { - MWR_LOGD("[ENTER]"); + MWR_LOGI("[ENTER]"); if (nullptr == mSelectedEngine) return; @@ -325,7 +325,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() while (!(mStopStreamingThread.load())) { this_thread::sleep_for(chrono::milliseconds(10)); if (index < interface->get_utterance_data_count()) { - MWR_LOGI("[INFO] Resume thread"); + MWR_LOGD("[INFO] Resume thread"); break; } if (g_speech_pcm_wait_count < cnt) { @@ -347,7 +347,7 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() } cnt++; } - MWR_LOGI("[INFO] Finish to wait for new feedback data come"); + MWR_LOGD("[INFO] Finish to wait for new feedback data come"); /* resume feedback thread */ continue; @@ -383,6 +383,8 @@ void CWakeupEngineManager::streaming_speech_data_thread_func() } } } + + MWR_LOGI("[EXIT]"); } void CWakeupEngineManager::start_streaming_current_utterance_data() @@ -587,7 +589,7 @@ bool CWakeupEngineManager::on_error(string engine_name, int error_code, string e bool CWakeupEngineManager::on_audio_data_require_status(string engine_name, bool require) { - MWR_LOGD("[ENTER] %s, %d", engine_name.c_str(), require); + MWR_LOGI("[ENTER] %s, %d", engine_name.c_str(), require); bool found = false; // LOCK REQUIRED diff --git a/plugins/wakeup-manager/src/wakeup_manager.cpp b/plugins/wakeup-manager/src/wakeup_manager.cpp index c4e42cf..b2c427d 100644 --- a/plugins/wakeup-manager/src/wakeup_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager.cpp @@ -392,6 +392,7 @@ bool CWakeupManager::set_streaming_mode(STREAMING_MODE mode) bool CWakeupManager::change_manager_state(wakeup_manager_state_e state) { + MWR_LOGI("[ENTER] : %d", state); mWakeupManagerState = state; mWakeupEngineManager.update_manager_state(state); for (const auto& observer : mWakeupObservers) { @@ -573,7 +574,7 @@ vector CWakeupManager::get_setting_observers() static Eina_Bool streaming_duration_expired(void *data) { - MWR_LOGD("[ENTER]"); + MWR_LOGW("[ENTER]"); CWakeupManager *wakeup_manager = static_cast(data); if (nullptr == wakeup_manager) return ECORE_CALLBACK_CANCEL; diff --git a/src/multi_assistant_dbus.c b/src/multi_assistant_dbus.c index eab7619..34de016 100644 --- a/src/multi_assistant_dbus.c +++ b/src/multi_assistant_dbus.c @@ -162,7 +162,7 @@ int masc_dbus_send_error_message(int reason, const char* err_msg) if (!dbus_connection_send(g_conn_sender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] <<<< error message : Out Of Memory !"); } else { - MAS_LOGD("<<<< Send error message : reason(%d), err_msg(%s)", reason, temp_err_msg); + MAS_LOGI("<<<< Send error message : reason(%d), err_msg(%s)", reason, temp_err_msg); dbus_connection_flush(g_conn_sender); } @@ -219,7 +219,7 @@ int masc_dbus_send_streaming_audio_data(int pid, int event, unsigned char* data, } else { static int last_event = -1; if (event != last_event) { - MAS_LOGI("[Dbus DEBUG] Success to Send utterance stream : event (%d)", event); + MAS_LOGI("[Dbus DEBUG] Success to Send utterance stream : %d event (%d)", pid, event); } last_event = event; dbus_connection_flush(g_conn_sender); @@ -272,7 +272,7 @@ int masc_dbus_active_state_change(int pid, int state) MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[Dbus DEBUG] Success to Send activate message : %d", state); + MAS_LOGI("[Dbus DEBUG] Success to Send activate message : %d %d", pid, state); dbus_connection_flush(g_conn_sender); } @@ -333,7 +333,7 @@ int masc_dbus_send_preprocessing_information(int pid, const char* app_id) free(temp_app_id); return -1; // MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[Dbus DEBUG] Success to Send preprocessing assistant information : %s", app_id); + MAS_LOGI("[Dbus DEBUG] Success to Send preprocessing assistant information : %d %s", pid, app_id); dbus_connection_flush(g_conn_sender); } @@ -388,7 +388,7 @@ int masc_dbus_send_streaming_section_changed(int pid, int section) MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[Dbus DEBUG] Success to Send streaming section changed information : %d", section); + MAS_LOGI("[Dbus DEBUG] Success to Send streaming section changed information : %d %d", pid, section); dbus_connection_flush(g_conn_sender); } @@ -442,7 +442,7 @@ int masc_dbus_send_preprocessing_result(int pid, bool result) MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[Dbus DEBUG] Success to Send preprocessing result : %d", temp_result); + MAS_LOGI("[Dbus DEBUG] Success to Send preprocessing result : %d %d", pid, temp_result); dbus_connection_flush(g_conn_sender); } @@ -504,7 +504,7 @@ int masc_dbus_send_wakeup_engine_command(int pid, const char* command) free(temp_command); return -1; // MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[Dbus DEBUG] Success to Send wakeup_engine_command : %s", command); + MAS_LOGI("[Dbus DEBUG] Success to Send wakeup_engine_command : %d %s", pid, command); dbus_connection_flush(g_conn_sender); } @@ -559,7 +559,7 @@ int masc_dbus_service_state_change(int pid, int state) MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[Dbus DEBUG] Success to Send activate message : %d", state); + MAS_LOGI("[Dbus DEBUG] Success to Send activate message : %d %d", pid, state); dbus_connection_flush(g_conn_sender); } diff --git a/src/multi_assistant_dbus_server.c b/src/multi_assistant_dbus_server.c index c229817..136606b 100644 --- a/src/multi_assistant_dbus_server.c +++ b/src/multi_assistant_dbus_server.c @@ -69,7 +69,7 @@ int ma_service_dbus_initialize(DBusConnection* conn, DBusMessage* msg) DBusMessage* reply; reply = dbus_message_new_method_return(msg); - MAS_LOGD("[OUT] mas initialize : result(%d)", ret); + MAS_LOGI("[OUT] mas initialize : result(%d)", ret); if (NULL != reply) { dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, @@ -120,7 +120,7 @@ int ma_service_dbus_deinitialize(DBusConnection* conn, DBusMessage* msg) DBusMessage* reply; reply = dbus_message_new_method_return(msg); - MAS_LOGD("[OUT] mas deinitialize : result(%d)", ret); + MAS_LOGI("[OUT] mas deinitialize : result(%d)", ret); if (NULL != reply) { dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, @@ -165,7 +165,7 @@ int ma_service_dbus_get_audio_format(DBusConnection* conn, DBusMessage* msg) dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas get default voice"); + MAS_LOGD("[IN] mas get audio format"); ret = mas_client_get_audio_format(pid, &rate, &channel, &audio_type); } @@ -181,7 +181,7 @@ int ma_service_dbus_get_audio_format(DBusConnection* conn, DBusMessage* msg) DBUS_TYPE_INT32, &audio_type, DBUS_TYPE_INVALID); if (0 == ret) { - MAS_LOGD("[OUT] mas get audio format : rate(%d), channel(%d), audio_type(%d)", rate, channel, audio_type); + MAS_LOGI("[OUT] mas get audio format : rate(%d), channel(%d), audio_type(%d)", rate, channel, audio_type); } else { MAS_LOGE("[OUT ERROR] mas get audio format : result(%d)", ret); } @@ -219,7 +219,7 @@ int ma_service_dbus_get_audio_source_type(DBusConnection* conn, DBusMessage* msg dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas get default voice"); + MAS_LOGD("[IN] mas get audio source type"); ret = mas_client_get_audio_source_type(pid, &type); } @@ -240,7 +240,7 @@ int ma_service_dbus_get_audio_source_type(DBusConnection* conn, DBusMessage* msg DBUS_TYPE_STRING, &temp_type, DBUS_TYPE_INVALID); if (0 == ret) { - MAS_LOGD("[OUT] mas get audio source type : type(%s)", temp_type); + MAS_LOGI("[OUT] mas get audio source type : type(%s)", temp_type); } else { MAS_LOGE("[OUT ERROR] mas get audio source type : result(%d)", ret); } @@ -283,7 +283,7 @@ int ma_service_dbus_send_asr_result(DBusConnection* conn, DBusMessage* msg) dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas send asr result : pid(%d), event(%d), asr_result(%s)", pid, event, asr_result); + MAS_LOGI("[IN] mas send asr result : pid(%d), event(%d), asr_result(%s)", pid, event, asr_result); ret = mas_client_send_asr_result(pid, event, asr_result); } @@ -342,7 +342,7 @@ int ma_service_dbus_send_result(DBusConnection* conn, DBusMessage* msg) dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas send result : pid(%d), display_text(%s), utterance_text(%s), result_json(%s)", pid, display_text, utterance_text, result_json); + MAS_LOGI("[IN] mas send result : pid(%d), display_text(%s), utterance_text(%s), result_json(%s)", pid, display_text, utterance_text, result_json); ret = mas_client_send_result(pid, display_text, utterance_text, result_json); } @@ -393,11 +393,11 @@ int ma_service_dbus_send_recognition_result(DBusConnection* conn, DBusMessage* m MAS_LOGD("[DEBUG] MAS SEND RECOGNITION RESULT"); if (dbus_error_is_set(&err)) { - MAS_LOGE("[IN ERROR] mas send error : Get arguments error (%s)", err.message); + MAS_LOGE("[IN ERROR] mas send recognition result : Get arguments error (%s)", err.message); dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas send error : pid(%d), result(%d)", pid, result); + MAS_LOGI("[IN] mas send recognition result : pid(%d), result(%d)", pid, result); ret = mas_client_send_recognition_result(pid, result); } @@ -428,7 +428,7 @@ int ma_service_dbus_start_streaming_audio_data(DBusConnection* conn, DBusMessage dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas send start streaming : pid(%d), type(%d)", pid, type); + MAS_LOGI("[IN] mas send start streaming : pid(%d), type(%d)", pid, type); ret = mas_client_start_streaming_audio_data(pid, type); } @@ -459,7 +459,7 @@ int ma_service_dbus_stop_streaming_audio_data(DBusConnection* conn, DBusMessage* dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas stop streaming : pid(%d), type(%d)", pid, type); + MAS_LOGI("[IN] mas stop streaming : pid(%d), type(%d)", pid, type); ret = mas_client_stop_streaming_audio_data(pid, type); } @@ -490,7 +490,7 @@ int ma_service_dbus_update_voice_feedback_state(DBusConnection* conn, DBusMessag dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas update voice feedback : pid(%d), state(%d)", pid, state); + MAS_LOGI("[IN] mas update voice feedback : pid(%d), state(%d)", pid, state); ret = mas_client_update_voice_feedback_state(pid, state); } @@ -521,7 +521,7 @@ int ma_service_dbus_send_assistant_specific_command(DBusConnection* conn, DBusMe dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas send assistant specific command : pid(%d), command(%s)", pid, command); + MAS_LOGI("[IN] mas send assistant specific command : pid(%d), command(%s)", pid, command); ret = mas_client_set_assistant_specific_command(pid, command); } @@ -552,7 +552,7 @@ int ma_service_dbus_set_background_volume(DBusConnection* conn, DBusMessage* msg dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas set background volume : pid(%d), ratio(%f)", pid, ratio); + MAS_LOGI("[IN] mas set background volume : pid(%d), ratio(%f)", pid, ratio); ret = mas_client_set_background_volume(pid, ratio); } @@ -589,7 +589,7 @@ int ma_service_dbus_set_preprocessing_allow_mode(DBusConnection* conn, DBusMessa if (NULL != app_id && strcmp("#NULL", app_id)) { temp_app_id = strdup(app_id); } - MAS_LOGD("[IN] mas set preprocessing allow mode : pid(%d), mode(%d), app_id(%s)", pid, mode, temp_app_id); + MAS_LOGI("[IN] mas set preprocessing allow mode : pid(%d), mode(%d), app_id(%s)", pid, mode, temp_app_id); ret = mas_client_set_preprocessing_allow_mode(pid, mode, temp_app_id); if (NULL != temp_app_id) free(temp_app_id); @@ -622,7 +622,7 @@ int ma_service_dbus_send_preprocessing_result(DBusConnection* conn, DBusMessage* dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas send preprocessing result : pid(%d), result(%d)", pid, result); + MAS_LOGI("[IN] mas send preprocessing result : pid(%d), result(%d)", pid, result); ret = mas_client_send_preprocessing_result(pid, (bool)result); } @@ -653,7 +653,7 @@ int ma_service_dbus_set_wake_word_audio_require_flag(DBusConnection* conn, DBusM dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas set wake word audio require flag : pid(%d), require(%d)", pid, require); + MAS_LOGI("[IN] mas set wake word audio require flag : pid(%d), require(%d)", pid, require); ret = mas_client_set_wake_word_audio_require_flag(pid, (bool)require); } @@ -684,7 +684,7 @@ int ma_service_dbus_set_assistant_language(DBusConnection* conn, DBusMessage* ms dbus_error_free(&err); ret = -1; //MAS_ERROR_OPERATION_FAILED; } else { - MAS_LOGD("[IN] mas set assistant language : pid(%d), language(%s)", pid, language); + MAS_LOGI("[IN] mas set assistant language : pid(%d), language(%s)", pid, language); ret = mas_client_set_assistant_language(pid, language); } -- 2.7.4