Fix order of log message handling

This commit is contained in:
Eric Torres 2019-04-24 09:19:31 -07:00
parent 0f56420fd6
commit 9b9744ad1d

View File

@ -132,12 +132,20 @@ def parse_cmdline_arguments(**kwargs):
if __name__ == "__main__": if __name__ == "__main__":
args = parse_cmdline_arguments() args = parse_cmdline_arguments()
if args.verbose:
stdout_handler.setLevel(logging.INFO)
if args.debug:
stdout_handler.setLevel(logging.DEBUG)
dest = ( dest = (
args.repository args.repository
if args.remote_host is None if args.remote_host is None
else f"{args.remote_host}@{os.getlogin()}:{args.port}{args.repository}" else f"{args.remote_host}@{os.getlogin()}:{args.port}{args.repository}"
) )
syslog.debug(f"Repository destination: {dest}")
try: try:
parsed_config = config.parse_configfile() parsed_config = config.parse_configfile()
repo = Repository(dest) repo = Repository(dest)
@ -147,12 +155,6 @@ if __name__ == "__main__":
else: else:
script.do_backup(repo, parsed_config, args) script.do_backup(repo, parsed_config, args)
if args.verbose:
stdout_handler.setLevel(logging.INFO)
if args.debug:
stdout_handler.setLevel(logging.DEBUG)
if args.run_post_sync: if args.run_post_sync:
syslog.info("Running sync operation") syslog.info("Running sync operation")
os.sync() os.sync()