def log_hook(): """Log when a hook starts and stops its execution. Also log to stdout possible CalledProcessError exceptions raised executing the hook. """ script = script_name() log(">>> Entering {}".format(script)) try: yield except CalledProcessError as err: log('Exception caught:') log(err.output) raise finally: log("<<< Exiting {}".format(script))
def log_exit(): log("<-- Exiting {}".format(script_name()))
def log_entry(): log("--> Entering {}".format(script_name()))