Stop using print! Understanding and using the "logging" module
- 30 minutes
If you're like me, then you've long known about Python's "logging" module, but you've ignored it because it seemed too complex. In this talk, I'll show you that "logging" is easy to learn and use, giving you far more flexibility than you can get from inserting calls to "print" all over your code. I'll show you how you can start to use "logging" right away -- but also how you can use it to create a sophisticated logging system that sends different types of output to different destinations. After this talk, you'll know how to use "logging", and you'll be less likely to use "print" in your applications.
You don't need to be a Python expert to use the "logging" module! In this talk, I'll show how you can take advantage of it almost right away, with the basic configuration. We'll then go into more complex parts of the module, looking at different handler types (and using multiple handlers), formatters, and filters. We'll look at different ways you can configure your logging system, and what some of the best practices are for including logging in your programs.
I'm aiming this talk at beginners because it took me far too long to recognize the usefulness of the "logging" module, and I'm hoping to help others start using it much earlier in their Python journey.