Added logging using python's logging module instead of print statements.