Wednesday, June 6, 2018

Use logging instead of print in python

Quick! Think about a way to output a message in python! If you think about print immediately, you are not the only one. It is true that print is the most popular method to output a message in python, but using logging is actually better.

Advantages of using logging instead of print:


1. User friendly. A user can see when and where a logging comes from.


2. Easier to manage.  It is easier to format them.


3. Easier to differentiate. Logging can be differentiated based on severity.

No comments:

Post a Comment