Mercurial > libervia-backend
diff sat/tools/config.py @ 3148:60a9e47ef988
core: log filenames of read config files
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 29 Jan 2020 19:42:02 +0100 |
parents | 559a625a236b |
children | a3639d6d9643 |
line wrap: on
line diff
--- a/sat/tools/config.py Wed Jan 29 19:28:08 2020 +0100 +++ b/sat/tools/config.py Wed Jan 29 19:42:02 2020 +0100 @@ -99,13 +99,22 @@ fixConfigOption("", "local_dir", old_default, silent) -def parseMainConf(): - """look for main .ini configuration file, and parse it""" +def parseMainConf(log_filenames=False): + """Look for main .ini configuration file, and parse it + + @param log_filenames(bool): if True, log filenames of read config files + """ config = ConfigParser(defaults=C.DEFAULT_CONFIG) try: - config.read(C.CONFIG_FILES) + filenames = config.read(C.CONFIG_FILES) except Exception as e: log.error(_("Can't read main config: {msg}").format(msg=e), exc_info=True) + else: + if log_filenames: + log.info( + _("Configuration was read from: {filenames}").format( + filenames=', '.join(filenames))) + return config