From 9661e90a056ffa3395f0857e080adaf8006988a0 Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Thu, 20 Feb 2025 15:45:32 +0000 Subject: [PATCH] Allow disabling logging in auto_archiver with logging: enabled: false --- src/auto_archiver/core/orchestrator.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/auto_archiver/core/orchestrator.py b/src/auto_archiver/core/orchestrator.py index c2dbb58..274fa9e 100644 --- a/src/auto_archiver/core/orchestrator.py +++ b/src/auto_archiver/core/orchestrator.py @@ -231,14 +231,20 @@ class ArchivingOrchestrator: self.basic_parser.exit() def setup_logging(self, config): + + logging_config = config['logging'] + + if logging_config.get('enabled', True) is False: + # disabled logging settings, they're set on a higher level + logger.disable('auto_archiver') + return + # setup loguru logging try: logger.remove(0) # remove the default logger except ValueError: pass - logging_config = config['logging'] - # add other logging info if self.logger_id is None: # note - need direct comparison to None since need to consider falsy value 0 self.logger_id = logger.add(sys.stderr, level=logging_config['level'])