Change print statements to log statements