Python logging: stop using print in your Python code for logging, use the logging module like a pro.

When we write Python programs, we often need to print out the results and also log some exceptions. As a beginner, we would normally use the print function to log everything. It is handy to use the print command but the logs are not stored properly and are difficult to check sometime after the program is finished. As a best practice for logging in Python, we should use the built-in logging module. With the logging module, we can log different levels of messages to different destinations…