Replace use of print with Python's logging infrastructure.