What is the difference between the logger object and the print object?
Difference between logger and print
hey @Mohit2000 ,
Both are used for somewhat same purpose but are a bit different from each other.
The logging package has a lot of useful features:
- Easy to see where and when (even what line no.) a logging call is being made from.
- You can log to files, sockets, pretty much anything, all at the same time.
- You can differentiate your logging based on severity.
Print doesn’t have any of these.
And while working on different threads , print statement can’t differentiate between threads , but logger can.
I hope this helps you .
Why second parameter is passed as level=logging.INFO while defining config for the logging
hey @Mohit2000 ,
it means in which manner we want our logging output to be.
Similar like we have an error message , info message , simple message ,a warning etc.
Its just one of those kinds.
So, we are specifying it when defining logging? So when we write logger.error, how things are working. Please explain a bit more.
I didn’t understand that, can you please provide a screenshot relating the same.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.