From: Jaehyun Kim Date: Fri, 16 Oct 2020 07:51:48 +0000 (+0900) Subject: Fix an issue where the log option is not applied properly X-Git-Tag: accepted/tizen/unified/20201029.124906~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fconnman.git;a=commitdiff_plain;h=968835a6331514c865a8a471cc6b055fcdd1f687 Fix an issue where the log option is not applied properly Change-Id: Ibb5305175a1987d74f0a24ba413a664940233e76 Signed-off-by: Jaehyun Kim --- diff --git a/include/log.h b/include/log.h index 7687ed0..9403633 100755 --- a/include/log.h +++ b/include/log.h @@ -22,6 +22,10 @@ #ifndef __CONNMAN_LOG_H #define __CONNMAN_LOG_H +#if defined TIZEN_EXT +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -86,6 +90,14 @@ struct connman_debug_desc { __FILE__, __FUNCTION__ , ## arg); \ } while (0) +#if defined TIZEN_EXT +#define simplified_log get_simple_log_option() +bool get_simple_log_option(void); +void set_simple_log_option(bool option); +void set_dlog_logging_option(bool option); +void set_file_logging_option(bool option); +#endif + #ifdef __cplusplus } #endif diff --git a/src/connman.h b/src/connman.h index 82e584e..9e28ffe 100755 --- a/src/connman.h +++ b/src/connman.h @@ -1222,9 +1222,6 @@ int __connman_util_init(void); void __connman_util_cleanup(void); #ifdef TIZEN_EXT -__attribute__ ((unused)) static bool dlog_logging = true; -__attribute__ ((unused)) static bool file_logging = true; -__attribute__ ((unused)) static bool simplified_log = true; __attribute__ ((unused)) static int __tizentvextension = -1; #define TIZEN_TV_EXT (__builtin_expect(__tizentvextension != -1, 1) ? \ __tizentvextension : \ diff --git a/src/log.c b/src/log.c index 8dbbb04..7a4839b 100755 --- a/src/log.c +++ b/src/log.c @@ -40,6 +40,7 @@ static const char *program_path; #if defined TIZEN_EXT #include #include +#include #include #undef LOG_TAG @@ -55,6 +56,29 @@ static const char *program_path; #define syslog __connman_log_s static FILE *log_file = NULL; +static bool dlog_logging = true; +static bool file_logging = true; +static bool simple_log = true; + +bool get_simple_log_option(void) +{ + return simple_log; +} + +void set_simple_log_option(bool option) +{ + simple_log = option; +} + +void set_dlog_logging_option(bool option) +{ + dlog_logging = option; +} + +void set_file_logging_option(bool option) +{ + file_logging = option; +} void __connman_log_open(const char *ident, int option, int facility) { diff --git a/src/main.c b/src/main.c index 7938a06..7e63812 100755 --- a/src/main.c +++ b/src/main.c @@ -106,7 +106,7 @@ static struct { char *def_wifi_ifname; bool file_log; bool dlog_log; - bool simplified_log; + bool simple_log; #endif } connman_settings = { .bg_scan = true, @@ -139,7 +139,7 @@ static struct { .def_wifi_ifname = DEFAULT_WIFI_INTERFACE, .file_log = true, .dlog_log = true, - .simplified_log = true, + .simple_log = true, #endif }; @@ -695,7 +695,7 @@ static void check_Tizen_configuration(GKeyFile *config) boolean = __connman_config_get_bool(config, "General", CONF_CONNMAN_SIMPLIFIED_LOG, &error); if (!error) - connman_settings.simplified_log = boolean; + connman_settings.simple_log = boolean; g_clear_error(&error); @@ -940,10 +940,11 @@ static int config_init(const char *file) parse_config(config); if (config) g_key_file_free(config); + #if defined TIZEN_EXT - dlog_logging = connman_settings.dlog_log; - file_logging = connman_settings.file_log; - simplified_log = connman_settings.simplified_log; + set_simple_log_option(connman_settings.simple_log); + set_dlog_logging_option(connman_settings.dlog_log); + set_file_logging_option(connman_settings.file_log); #endif return 0; } @@ -1179,7 +1180,7 @@ bool connman_setting_get_bool(const char *key) return connman_settings.dlog_log; if (g_str_equal(key, CONF_CONNMAN_SIMPLIFIED_LOG)) - return connman_settings.simplified_log; + return connman_settings.simple_log; #endif #if defined TIZEN_EXT diff --git a/src/service.c b/src/service.c index e6cc61c..a1e745d 100755 --- a/src/service.c +++ b/src/service.c @@ -10021,7 +10021,7 @@ static int service_register(struct connman_service *service) if (ret == -ERANGE) service_ext_save(service); ret = __connman_config_provision_service(service); - if (ret < 0 && simplified_log) + if (ret < 0 && !simplified_log) DBG("Failed to provision service"); #else if (__connman_config_provision_service(service) < 0)