+ #handle -L
+ loglevel_mapping = { 'debug' : logging.DEBUG,
+ 'info' : logging.INFO,
+ 'warning' : logging.WARNING,
+ 'error' : logging.ERROR,
+ 'critical' : logging.CRITICAL }
+
+ if args.logging_level in loglevel_mapping:
+ loglevel = loglevel_mapping[args.logging_level]
+ else:
+ print("Choose a valid log level: debug, info, warning, error, or critical")
+ exit
+
+ #handle -W
+ if args.logging_destination:
+ logging.basicConfig(filename=args.logging_destination, filemode='a', level=loglevel)
+ else:
+ logging.basicConfig(level=loglevel)
+
+ export_git_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode().strip()
+ export_git_short_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode().strip()
+ export_time = str(datetime.datetime.now())