swap print()s with logging.