use logging module instead of print().