Add a logging wrapper and replace print() functions by logging executions. Also add some additional logging.