Silent option for cron

This commit is contained in:
Ruben van de Ven 2022-02-18 10:18:32 +01:00
parent d55df06068
commit e631666cae

View file

@ -31,7 +31,7 @@ def update_or_create_record_for_zone(driver, zone, name, type, ip):
def run_config(config):
cls = get_driver(Provider.AURORADNS)
print(config)
# logger.debug("Config {}".format(config))
ipv6 = requests.get('http://ip6only.me/api').text.split(',')[1]
logger.info("IPv6: {}".format(ipv6))
@ -68,10 +68,18 @@ if __name__ == '__main__':
'-v',
action='store_true'
)
argParser.add_argument(
'--silent',
'-s',
action='store_true',
help="Only log on warning (decreases verbosity). For use with cron."
)
args = argParser.parse_args()
logLevel = logging.DEBUG if args.verbose else (logging.WARNING if args.silent else logging.INFO)
logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO)
logging.basicConfig(level=logLevel)
with open(args.config, 'r') as fp:
config = yaml.load(fp)