From 8481efd03c96b391ded8c7271813cb9be418c8bb Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Fri, 22 Dec 2023 14:51:23 -0500 Subject: [PATCH] support log level override --- iso/empanadas/empanadas/util/dnf_utils.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/iso/empanadas/empanadas/util/dnf_utils.py b/iso/empanadas/empanadas/util/dnf_utils.py index 2aded86..a3ed965 100644 --- a/iso/empanadas/empanadas/util/dnf_utils.py +++ b/iso/empanadas/empanadas/util/dnf_utils.py @@ -1806,17 +1806,16 @@ class SigRepoSync: ) # This is temporary for now. - if logger is None: - self.log = logging.getLogger("sigreposync") - self.log.setLevel(logging.INFO) - handler = logging.StreamHandler(sys.stdout) - handler.setLevel(logging.INFO) - formatter = logging.Formatter( - '%(asctime)s :: %(name)s :: %(message)s', - '%Y-%m-%d %H:%M:%S' - ) - handler.setFormatter(formatter) - self.log.addHandler(handler) + self.log = logging.getLogger("sigreposync") + self.log.setLevel(getattr(logging, logger.upper(), 'INFO')) + handler = logging.StreamHandler(sys.stdout) + handler.setLevel(logging.INFO) + formatter = logging.Formatter( + '%(asctime)s :: %(name)s :: %(message)s', + '%Y-%m-%d %H:%M:%S' + ) + handler.setFormatter(formatter) + self.log.addHandler(handler) self.log.info('sig reposync init') self.log.info(self.profile + ' ' + self.major_version)