From c39eb1dbce281ed6f64f804a16fb28e5c8dceccd Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Wed, 11 Nov 2020 15:16:33 +0100 Subject: [PATCH] [cdist.emulator] Fix setting of log level (tests OK) --- cdist/emulator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cdist/emulator.py b/cdist/emulator.py index 60b94880..a2bdc3d4 100644 --- a/cdist/emulator.py +++ b/cdist/emulator.py @@ -120,17 +120,18 @@ class Emulator: level = logging.WARNING else: level = logging.WARNING + self.log = logging.getLogger(self.target_host[0]) try: logging.root.setLevel(level) + self.log.setLevel(level) except (ValueError, TypeError): # if invalid __cdist_log_level value logging.root.setLevel(logging.WARNING) + self.log.setLevel(logging.WARNING) colored_log = self.env.get('__cdist_colored_log', 'false') cdist.log.CdistFormatter.USE_COLORS = colored_log == 'true' - self.log = logging.getLogger(self.target_host[0]) - def commandline(self): """Parse command line"""