From d5d1b1a6fdb363f96a3879724d744ba951b98a15 Mon Sep 17 00:00:00 2001 From: Yuanle Song Date: Sun, 1 Sep 2019 23:15:51 +0800 Subject: [PATCH] v0.7.3 control log output changed some g_message to g_debug to reduce log during normal usage. especially, do not log user's preedit_str, this could leak sensitive user data to syslog. --- main.c | 6 +++--- meson.build | 2 +- zero-pinyin-service.c | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index afd2ac0..137b580 100644 --- a/main.c +++ b/main.c @@ -32,8 +32,8 @@ on_handle_get_candidates(ZeroPinyinService *object, "Bad param"); return TRUE; } - g_message("get_candidates for preedit_str=%s fetch_size=%u", - preedit_str, fetch_size); + g_info("get_candidates for preedit_str=%s fetch_size=%u", + preedit_str, fetch_size); GVariant *result = NULL; GVariantBuilder *candidates_builder = NULL; @@ -84,7 +84,7 @@ on_handle_delete_candidate(ZeroPinyinService *object, } guint len = g_utf8_strlen(candidate, -1); if (len == 1) { - g_message("delete single character %s is a no-op", candidate); + g_debug("delete single character %s is a no-op", candidate); g_dbus_method_invocation_return_value(invocation, NULL); return TRUE; } diff --git a/meson.build b/meson.build index d76f58b..bdb0546 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ # -*- mode: conf -*- project('zero-pinyin-service', ['c', 'cpp'], - version: '0.7.2', + version: '0.7.3', license: 'GPL', default_options: [ 'warning_level=2', diff --git a/zero-pinyin-service.c b/zero-pinyin-service.c index d941ed7..0bb24f3 100644 --- a/zero-pinyin-service.c +++ b/zero-pinyin-service.c @@ -329,7 +329,7 @@ get_candidates(sqlite3 *db, guint r = 0; GList *candidates = NULL; while (fetched_size < fetch_size && group_size > 0) { - g_message("phrase length=%u", group_size); + g_info("phrase length=%u", group_size); r = get_candidates_for_n_pinyin(db, preedit_str, pylist, group_size, fetch_size - fetched_size, &candidates); if (candidates) { GList *iter = g_list_first(candidates); @@ -344,11 +344,11 @@ get_candidates(sqlite3 *db, } g_list_free_full(candidates, g_free); } - g_message("%u candidates found", r); + g_info("%u candidates found", r); fetched_size += r; group_size--; } - g_message("returning %u candidates", fetched_size); + g_info("returning %u candidates", fetched_size); g_list_free_full(pylist, g_free); } @@ -405,7 +405,7 @@ _update_userdb_py_phrase(sqlite3 *db, g_warning("INSERT candidate to userdb failed"); } else { if (sqlite3_changes(db) == 1) { - g_message("candidate %s inserted to userdb", candidate); + g_debug("candidate %s inserted to userdb", candidate); } } g_string_free(sql, TRUE); @@ -432,7 +432,7 @@ _update_userdb_py_phrase(sqlite3 *db, g_warning("UPDATE candidate user_freq failed"); } else { if (sqlite3_changes(db) == 1) { - g_message("candidate %s user_freq incremented", candidate); + g_info("candidate %s user_freq incremented", candidate); } else { g_warning("UPDATE candidate user_freq failed, no match"); } @@ -453,7 +453,7 @@ _update_userdb_not_phrase(sqlite3 *db, g_warning("DELETE candidate from not_phrase failed"); } else { if (sqlite3_changes(db) == 1) { - g_message("candidate %s removed from not_phrase", candidate); + g_debug("candidate %s removed from not_phrase", candidate); } } sqlite3_free(sql); @@ -478,7 +478,7 @@ commit_candidate(sqlite3 *db, } guint len = g_utf8_strlen(candidate, -1); if (len <= 1) { - g_message("commit single character %s is a no-op", candidate); + g_info("commit single character %s is a no-op", candidate); return; } _update_userdb_py_phrase(db, candidate, candidate_pinyin_indices, len); -- GitLab