From: taeyoung Date: Wed, 18 Nov 2015 06:21:17 +0000 (+0900) Subject: log: change dlog macro to _I, _D, and _E X-Git-Tag: submit/tizen/20151223.052758~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83f482bc8f8c62bfe9fe4d78f52279e1c2fda898;p=platform%2Fcore%2Fapi%2Fsystem-info.git log: change dlog macro to _I, _D, and _E - LOG_TAG also is defined at one file Change-Id: I6cb5d3395eae817274b9e9bab61bc3090075c703 Signed-off-by: taeyoung --- diff --git a/include/system_info_private.h b/include/system_info_private.h index 60cd51e..dd897fb 100644 --- a/include/system_info_private.h +++ b/include/system_info_private.h @@ -23,13 +23,18 @@ extern "C" { #endif +#include +#include + #ifndef API #define API __attribute__ ((visibility("default"))) #endif -#define CPU_INFO_FILE_PATH "/proc/cpuinfo" -#define CPU_INFO_MAX_FREQ_PATH "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq" -#define MAXBUFSIZE 512 +#undef LOG_TAG +#define LOG_TAG "CAPI_SYSTEM_INFO" +#define _D(fmt, args...) SLOGD(fmt, ##args) +#define _E(fmt, args...) SLOGE(fmt, ##args) +#define _I(fmt, args...) SLOGI(fmt, ##args) #define PLATFORM_TAG "platform" #define CUSTOM_TAG "custom" diff --git a/src/system_info.c b/src/system_info.c index 1441e89..b20b9a0 100644 --- a/src/system_info.c +++ b/src/system_info.c @@ -21,18 +21,10 @@ #include #include -#include - #include #include #include -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "CAPI_SYSTEM_INFO" - #define SYSTEM_INFO_MAX -1 API int system_info_get_value_int(system_info_key_e key, int *value) @@ -64,7 +56,7 @@ API int system_info_get_platform_bool(const char *key, bool *value) supported = (bool *)value; if (access(CONFIG_FILE_PATH, R_OK)) { - LOGE("cannot find file %s!!!", CONFIG_FILE_PATH); + _E("cannot find file %s!!!", CONFIG_FILE_PATH); if (errno == EPERM || errno == EACCES) return SYSTEM_INFO_ERROR_PERMISSION_DENIED; return SYSTEM_INFO_ERROR_IO_ERROR; @@ -72,7 +64,7 @@ API int system_info_get_platform_bool(const char *key, bool *value) ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, BOOL_TYPE, &string); if (ret) { - LOGE("cannot get %s", key); + _E("cannot get %s", key); return ret; } @@ -95,7 +87,7 @@ API int system_info_get_platform_int(const char *key, int *value) ret_val = (int *)value; if (access(CONFIG_FILE_PATH, R_OK)) { - LOGE("cannot find file %s!!!", CONFIG_FILE_PATH); + _E("cannot find file %s!!!", CONFIG_FILE_PATH); if (errno == EPERM || errno == EACCES) return SYSTEM_INFO_ERROR_PERMISSION_DENIED; return SYSTEM_INFO_ERROR_IO_ERROR; @@ -103,7 +95,7 @@ API int system_info_get_platform_int(const char *key, int *value) ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, INT_TYPE, &string); if (ret) { - LOGE("cannot get %s", key); + _E("cannot get %s", key); return ret; } @@ -123,7 +115,7 @@ API int system_info_get_platform_double(const char *key, double *value) ret_val = (double *)value; if (access(CONFIG_FILE_PATH, R_OK)) { - LOGE("cannot find file %s!!!", CONFIG_FILE_PATH); + _E("cannot find file %s!!!", CONFIG_FILE_PATH); if (errno == EPERM || errno == EACCES) return SYSTEM_INFO_ERROR_PERMISSION_DENIED; return SYSTEM_INFO_ERROR_IO_ERROR; @@ -131,7 +123,7 @@ API int system_info_get_platform_double(const char *key, double *value) ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, DBL_TYPE, &string); if (ret) { - LOGE("cannot get %s", key); + _E("cannot get %s", key); return ret; } @@ -148,7 +140,7 @@ API int system_info_get_platform_string(const char *key, char **value) char *string = NULL; if (access(CONFIG_FILE_PATH, R_OK)) { - LOGE("cannot find file %s!!!", CONFIG_FILE_PATH); + _E("cannot find file %s!!!", CONFIG_FILE_PATH); if (errno == EPERM || errno == EACCES) return SYSTEM_INFO_ERROR_PERMISSION_DENIED; return SYSTEM_INFO_ERROR_IO_ERROR; @@ -162,7 +154,7 @@ API int system_info_get_platform_string(const char *key, char **value) ret = system_info_get_value_from_config_xml(PLATFORM_TAG, key, STR_TYPE, &string); if (ret) { - LOGE("cannot get %s", key); + _E("cannot get %s", key); return ret; } @@ -180,7 +172,7 @@ API int system_info_get_custom_bool(const char *key, bool *value) supported = (bool *)value; if (access(CONFIG_FILE_PATH, R_OK)) { - LOGE("cannot find file %s!!!", CONFIG_FILE_PATH); + _E("cannot find file %s!!!", CONFIG_FILE_PATH); if (errno == EPERM || errno == EACCES) return SYSTEM_INFO_ERROR_PERMISSION_DENIED; return SYSTEM_INFO_ERROR_IO_ERROR; @@ -188,7 +180,7 @@ API int system_info_get_custom_bool(const char *key, bool *value) ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, BOOL_TYPE, &string); if (ret) { - LOGE("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH); + _E("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH); return ret; } @@ -211,7 +203,7 @@ API int system_info_get_custom_int(const char *key, int *value) ret_val = (int *)value; if (access(CONFIG_FILE_PATH, R_OK)) { - LOGE("cannot find file %s!!!", CONFIG_FILE_PATH); + _E("cannot find file %s!!!", CONFIG_FILE_PATH); if (errno == EPERM || errno == EACCES) return SYSTEM_INFO_ERROR_PERMISSION_DENIED; return SYSTEM_INFO_ERROR_IO_ERROR; @@ -219,7 +211,7 @@ API int system_info_get_custom_int(const char *key, int *value) ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, INT_TYPE, &string); if (ret) { - LOGE("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH); + _E("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH); return ret; } @@ -239,7 +231,7 @@ API int system_info_get_custom_double(const char *key, double *value) ret_val = (double *)value; if (access(CONFIG_FILE_PATH, R_OK)) { - LOGE("cannot find file %s!!!", CONFIG_FILE_PATH); + _E("cannot find file %s!!!", CONFIG_FILE_PATH); if (errno == EPERM || errno == EACCES) return SYSTEM_INFO_ERROR_PERMISSION_DENIED; return SYSTEM_INFO_ERROR_IO_ERROR; @@ -247,7 +239,7 @@ API int system_info_get_custom_double(const char *key, double *value) ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, DBL_TYPE, &string); if (ret) { - LOGE("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH); + _E("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH); return ret; } @@ -264,7 +256,7 @@ API int system_info_get_custom_string(const char *key, char **value) char *string = NULL; if (access(CONFIG_FILE_PATH, R_OK)) { - LOGE("cannot find file %s!!!", CONFIG_FILE_PATH); + _E("cannot find file %s!!!", CONFIG_FILE_PATH); if (errno == EPERM || errno == EACCES) return SYSTEM_INFO_ERROR_PERMISSION_DENIED; return SYSTEM_INFO_ERROR_IO_ERROR; @@ -272,7 +264,7 @@ API int system_info_get_custom_string(const char *key, char **value) ret = system_info_get_value_from_config_xml(CUSTOM_TAG, key, STR_TYPE, &string); if (ret) { - LOGE("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH); + _E("cannot get %s info from %s!!!", key, CONFIG_FILE_PATH); return ret; } diff --git a/src/system_info_file.c b/src/system_info_file.c index e44c2a8..a58e55b 100644 --- a/src/system_info_file.c +++ b/src/system_info_file.c @@ -22,17 +22,9 @@ #include #include -#include - #include #include -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "CAPI_SYSTEM_INFO" - #define SERIAL_TOK_DELIMITER "," #define BUF_MAX 256 @@ -43,12 +35,12 @@ static int get_tizenid(char **value) fp = fopen(TIZEN_ID_PATH, "r"); if (!fp) { - LOGE("Failed to open file (%s)", TIZEN_ID_PATH); + _E("Failed to open file (%s)", TIZEN_ID_PATH); return SYSTEM_INFO_ERROR_IO_ERROR; } if (fgets(id, sizeof(id), fp) == NULL) { - LOGE("Failed to get string (errno:%d)", errno); + _E("Failed to get string (errno:%d)", errno); fclose(fp); return SYSTEM_INFO_ERROR_IO_ERROR; } @@ -56,7 +48,7 @@ static int get_tizenid(char **value) fclose(fp); if (strlen(id) == 0) { - LOGE("String length of id is 0"); + _E("String length of id is 0"); return SYSTEM_INFO_ERROR_IO_ERROR; } diff --git a/src/system_info_parse.c b/src/system_info_parse.c index a65ecf0..20c9a06 100644 --- a/src/system_info_parse.c +++ b/src/system_info_parse.c @@ -19,8 +19,6 @@ #include #include -#include - #include #include @@ -30,12 +28,6 @@ #include #include -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "CAPI_SYSTEM_INFO" - #define MODEL_CONFIG_TAG "model-config" int system_info_ini_get_string(char *ini_file, char *key, char **output) @@ -47,14 +39,14 @@ int system_info_ini_get_string(char *ini_file, char *key, char **output) ini = iniparser_load(ini_file); if (ini == NULL) { - LOGE("cannot file open %s file!!!", ini_file); + _E("cannot file open %s file!!!", ini_file); return SYSTEM_INFO_ERROR_IO_ERROR; } str = iniparser_getstring(ini, key, NULL); if (str == NULL) { - LOGE("NOT found %s(0x%08x)", key, SYSTEM_INFO_ERROR_IO_ERROR); + _E("NOT found %s(0x%08x)", key, SYSTEM_INFO_ERROR_IO_ERROR); iniparser_freedict(ini); return SYSTEM_INFO_ERROR_IO_ERROR; } @@ -62,7 +54,7 @@ int system_info_ini_get_string(char *ini_file, char *key, char **output) tmp = strdup(str); if (tmp == NULL) { - LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY); + _E("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY); iniparser_freedict(ini); return SYSTEM_INFO_ERROR_OUT_OF_MEMORY; } @@ -86,13 +78,13 @@ int system_info_get_value_from_config_xml(char *feature_tag, const char *name_fi doc = xmlParseFile(CONFIG_FILE_PATH); if (doc == NULL) { - LOGE("cannot file open %s file!!!", CONFIG_FILE_PATH); + _E("cannot file open %s file!!!", CONFIG_FILE_PATH); return SYSTEM_INFO_ERROR_IO_ERROR; } cur = xmlDocGetRootElement(doc); if (cur == NULL) { - LOGE("empty document %s file!!!", CONFIG_FILE_PATH); + _E("empty document %s file!!!", CONFIG_FILE_PATH); xmlFreeDoc(doc); return SYSTEM_INFO_ERROR_IO_ERROR; } @@ -103,7 +95,7 @@ int system_info_get_value_from_config_xml(char *feature_tag, const char *name_fi } if (cur == NULL) { - LOGE("cannot find %s root element file!!!", MODEL_CONFIG_TAG); + _E("cannot find %s root element file!!!", MODEL_CONFIG_TAG); xmlFreeDoc(doc); return SYSTEM_INFO_ERROR_IO_ERROR; } @@ -116,7 +108,7 @@ int system_info_get_value_from_config_xml(char *feature_tag, const char *name_fi } if (model_node == NULL) { - LOGE("cannot find %s field from %s file!!!", name_field, CONFIG_FILE_PATH); + _E("cannot find %s field from %s file!!!", name_field, CONFIG_FILE_PATH); xmlFreeDoc(doc); return SYSTEM_INFO_ERROR_INVALID_PARAMETER; } @@ -138,7 +130,7 @@ int system_info_get_value_from_config_xml(char *feature_tag, const char *name_fi if (!strncmp(name, p_name, strlen(name))) { if (!strncmp(name, p_name, strlen(p_name))) { if (strncmp(type, type_field, strlen(type_field))) { - LOGE("INVALID_PARAMETER(0x%08x) : invalid output param", SYSTEM_INFO_ERROR_INVALID_PARAMETER); + _E("INVALID_PARAMETER(0x%08x) : invalid output param", SYSTEM_INFO_ERROR_INVALID_PARAMETER); free(name); free(type); xmlFreeDoc(doc); @@ -161,13 +153,13 @@ int system_info_get_value_from_config_xml(char *feature_tag, const char *name_fi } if (!cur_node) { - LOGE("cannot find %s field from %s file!!!", name_field, CONFIG_FILE_PATH); + _E("cannot find %s field from %s file!!!", name_field, CONFIG_FILE_PATH); xmlFreeDoc(doc); return SYSTEM_INFO_ERROR_INVALID_PARAMETER; } if (*value == NULL) { - LOGE("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY); + _E("OUT_OF_MEMORY(0x%08x)", SYSTEM_INFO_ERROR_OUT_OF_MEMORY); xmlFreeDoc(doc); return SYSTEM_INFO_ERROR_OUT_OF_MEMORY; }