Replacing print statements with Python logger