kopia lustrzana https://github.com/bellingcat/auto-archiver
Allow disabling logging in auto_archiver with logging: enabled: false
rodzic
0bec71d203
commit
9661e90a05
|
@ -231,14 +231,20 @@ class ArchivingOrchestrator:
|
||||||
self.basic_parser.exit()
|
self.basic_parser.exit()
|
||||||
|
|
||||||
def setup_logging(self, config):
|
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
|
# setup loguru logging
|
||||||
try:
|
try:
|
||||||
logger.remove(0) # remove the default logger
|
logger.remove(0) # remove the default logger
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
logging_config = config['logging']
|
|
||||||
|
|
||||||
# add other logging info
|
# add other logging info
|
||||||
if self.logger_id is None: # note - need direct comparison to None since need to consider falsy value 0
|
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'])
|
self.logger_id = logger.add(sys.stderr, level=logging_config['level'])
|
||||||
|
|
Ładowanie…
Reference in New Issue