Replace print statements with calls to logging hooks.