X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fstc-manager-util.c;h=1f259271689688ea438c8821596d760edd610e72;hb=f0ba9ea7c392f3047df7bafe21d27c4ae6157562;hp=b9294273298a9be218041378708d7a968ef89885;hpb=3292a32e4d3621fc117920f5a4aa40c547a980fd;p=platform%2Fcore%2Fconnectivity%2Fstc-manager.git diff --git a/src/stc-manager-util.c b/src/stc-manager-util.c index b929427..1f25927 100755 --- a/src/stc-manager-util.c +++ b/src/stc-manager-util.c @@ -16,7 +16,18 @@ #include "stc-manager-util.h" -static int g_debuglog = -1; +typedef struct { + int state; + char *key; +} log_info_s; + +log_info_s g_log_info[] = { + {-1, INFO_DEBUG_LOG}, + {-1, INFO_STAT_LOG}, + {-1, INFO_RSTN_LOG}, + {-1, INFO_FW_LOG}, + {-1, INFO_PCAP_LOG}, +}; static void __sync_file_to_disk(const char *path) { @@ -128,32 +139,47 @@ int stc_util_get_config_int(char *key) } //LCOV_EXCL_START -API void stc_util_set_debuglog(int debuglog) +API void stc_util_update_log_state(void) { - g_debuglog = debuglog; + int i; + + for (i = DEBUG_LOG_INFO; i < MAX_LOG_INFO; ++i) + g_log_info[i].state = stc_util_get_config_int(g_log_info[i].key); + + STC_LOGD("log info [%d:%d:%d:%d:%d]", + g_log_info[DEBUG_LOG_INFO].state, g_log_info[STAT_LOG_INFO].state, + g_log_info[RSTN_LOG_INFO].state, g_log_info[FW_LOG_INFO].state, + g_log_info[PCAP_LOG_INFO].state); +} + +API void stc_util_set_log_state(log_info_e info, int state) +{ + g_log_info[info].state = state; } //LCOV_EXCL_STOP -API int stc_util_get_debuglog(void) +API int stc_util_get_log_state(log_info_e info) { - if (g_debuglog == -1) - g_debuglog = stc_util_get_config_int(INFO_DEBUGLOG); + if (g_log_info[info].state == -1) + g_log_info[info].state = stc_util_get_config_int(g_log_info[info].key); - return g_debuglog; + return g_log_info[info].state; } void stc_util_initialize_config(void) { char path[MAX_PATH_LENGTH]; GKeyFile *keyfile; + int i; snprintf(path, sizeof(path), "%s/%s", INFO_STORAGE_DIR, INFO_CONFIG); keyfile = __load_key_file(path); - if (!keyfile) + if (!keyfile) { keyfile = g_key_file_new(); //LCOV_EXCL_LINE - - g_key_file_set_integer(keyfile, path, INFO_DEBUGLOG, 0); + for (i = DEBUG_LOG_INFO; i < MAX_LOG_INFO; ++i) + g_key_file_set_integer(keyfile, path, g_log_info[i].key, 0); + } __save_key_file(keyfile, path); }