summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2020-10-16 16:51:48 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2020-10-16 16:53:09 +0900
commit968835a6331514c865a8a471cc6b055fcdd1f687 (patch)
tree803e805155a95339e56b363bca92aee92873d128
parentb2c0ac0bd56e8070a05b7a7328fd611536c8794a (diff)
downloadconnman-968835a6331514c865a8a471cc6b055fcdd1f687.tar.gz
connman-968835a6331514c865a8a471cc6b055fcdd1f687.tar.bz2
connman-968835a6331514c865a8a471cc6b055fcdd1f687.zip
Fix an issue where the log option is not applied properly
Change-Id: Ibb5305175a1987d74f0a24ba413a664940233e76 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xinclude/log.h12
-rwxr-xr-xsrc/connman.h3
-rwxr-xr-xsrc/log.c24
-rwxr-xr-xsrc/main.c15
-rwxr-xr-xsrc/service.c2
5 files changed, 45 insertions, 11 deletions
diff --git a/include/log.h b/include/log.h
index 7687ed0b..9403633d 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 <stdbool.h>
+#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 82e584eb..9e28ffea 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 8dbbb04b..7a4839bf 100755
--- a/src/log.c
+++ b/src/log.c
@@ -40,6 +40,7 @@ static const char *program_path;
#if defined TIZEN_EXT
#include <sys/stat.h>
#include <sys/time.h>
+#include <stdbool.h>
#include <dlog.h>
#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 7938a069..7e638120 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 e6cc61c6..a1e745d9 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)