Replace print messages with logging, add --quiet mode to suppress logging.