Replaced all print statements with log messages