diff --git a/lib/nd_python/common/log_v2.py b/lib/nd_python/common/log_v2.py index c59e959..86a8dd1 100644 --- a/lib/nd_python/common/log_v2.py +++ b/lib/nd_python/common/log_v2.py @@ -290,6 +290,7 @@ def validate_logging_config(self, logging_config: dict) -> None: log.commit() ``` """ + msg: str = "" if len(logging_config.get("handlers", {})) == 0: msg = "logging.config.dictConfig: " msg += "No file handlers found. " @@ -299,15 +300,15 @@ def validate_logging_config(self, logging_config: dict) -> None: bad_handlers = [] for handler in logging_config.get("handlers", {}): if handler not in self.valid_handlers: - msg = "logging.config.dictConfig: " - msg += "handlers found that may interrupt Ansible module " - msg += "execution. " - msg += "Remove these handlers from the logging config file " - msg += "and try again. " bad_handlers.append(handler) if len(bad_handlers) > 0: - msg += f"Handlers: {','.join(bad_handlers)}. " - msg += f"Logging config file: {self.config}." + msg = f"Logging config file: {self.config}. " + msg += "logging.config.dictConfig: " + msg += "handlers found that may interrupt Ansible module " + msg += "execution. " + msg += "Remove these handlers from the logging config file " + msg += "and try again. " + msg += f"Bad Handlers: {','.join(bad_handlers)}. " raise ValueError(msg) def commit(self):