diff --git a/rbackup/rsync.py b/rbackup/rsync.py index f212e16..5286b58 100644 --- a/rbackup/rsync.py +++ b/rbackup/rsync.py @@ -3,6 +3,7 @@ .. module:: rbackup.rsync :synopsis: helper functions for running the rsync backend """ +import logging import subprocess @@ -10,6 +11,9 @@ import subprocess _RSYNC_BIN = "/usr/bin/rsync" +# ========== Logging Setup =========== +syslog = logging.getLogger(__name__) + # ========== Functions ========== def rsync(*args): """Run an rsync command. @@ -19,4 +23,14 @@ def rsync(*args): :raises: subprocess.CalledProcessError if rsync process failed """ cmd = [_RSYNC_BIN, *args] - subprocess.run(cmd, capture_output=True, check=True) + + syslog.debug(f"rsync command: {cmd}") + syslog.info("Beginning rsync process") + + try: + process = subprocess.run(cmd, capture_output=True, check=True) + except subprocess.CalledProcessError as e: + raise e + + syslog.debug(process.stdout) + syslog.info("Process complete")