Skip to main content
Loading page…
Python Mastery
Chapter 22
Lesson 3 of 5
Logging Like a Pro
Contents
Notes
Tutor
Note
Why Logging Uses %-Style, Not f-strings
Loading activity…
Previous
1 / 8
Continue
Contents
Notes
Discussion
Tutor
22 min
8 activities
0 of 8 done
In this lesson
1
Why Logging Uses %-Style, Not f-strings
2
Why Logging Beats Print
3
Module-Level Loggers with getLogger(__name__)
4
Handlers and Formatters
5
Quick Check: Log Level Filtering
6
Pitfall: String Formatting vs % Style in Log Calls
7
Practice: Wrap a Function with Logging
8
Pro Tip: Configure Logging Once, at the Top
Objectives
Learner can replace ad-hoc print statements with the logging module
Learner can configure log levels, formatters, and handlers (console and file)
Learner can obtain per-module loggers using getLogger(__name__)
Learner can structure a logging setup that is configurable without changing application code
Chapter 22 · The Standard Library Toolkit
Regular Expressions (re)
Dates & Times (datetime)
Logging Like a Pro
Config & Environment Variables
collections, math, random & more
Previous: Dates & Times (datetime)
Next: Config & Environment Variables