This is the website for an older EuroPython. Looking for the latest EuroPython? Click here!
Skip to main content

Stop using print! Understanding and using the "logging" module

Level:
beginner
Room:
south hall 2a
Start:
Duration:
30 minutes

Abstract

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.

TalkPython Libraries

Description

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.


The speaker

Reuven M. Lerner

Reuven M. Lerner

Reuven is a full-time Python trainer, teaching at companies around the world, and also offering a variety of online courses for individuals. He wrote "Python Workout" and "Pandas Workout," both published by Manning. Reuven writes three newsletters: Better Developers (about Python and software engineering), Bamboo Weekly (using Pandas to analyze current events), and Trainer Weekly (about the corporate training business). Reuven lives with his wife and three children in Modi'in, Israel.


← Back to schedule