changeset 1941:befdcfc55569

core (logs): use tools.config to handle sat.conf
author Goffi <goffi@goffi.org>
date Mon, 18 Apr 2016 18:33:59 +0200
parents 3fdacba9da68
children 7f053e1f0b67
files src/core/log_config.py
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/log_config.py	Mon Apr 18 18:33:59 2016 +0200
+++ b/src/core/log_config.py	Mon Apr 18 18:33:59 2016 +0200
@@ -398,19 +398,15 @@
         global C
         C = const
         log.C = const
-    import ConfigParser
+    from sat.tools import config
     import os
     log_conf = {}
-    config = ConfigParser.SafeConfigParser()
-    config.read(C.CONFIG_FILES)
+    sat_conf = config.parseMainConf()
     for opt_name, opt_default in C.LOG_OPTIONS():
         try:
             log_conf[opt_name] = os.environ[''.join((C.ENV_PREFIX, C.LOG_OPT_PREFIX.upper(), opt_name.upper()))]
         except KeyError:
-            try:
-                log_conf[opt_name] = config.get(C.LOG_OPT_SECTION, C.LOG_OPT_PREFIX + opt_name)
-            except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
-                log_conf[opt_name] = opt_default
+            log_conf[opt_name] = config.getConfig(sat_conf, C.LOG_OPT_SECTION, C.LOG_OPT_PREFIX + opt_name, opt_default)
 
     _parseOptions(log_conf)
     configure(backend, backend_data=backend_data, **log_conf)