07:31Understanding Python's logging Combine components like Lego blocks - nikkie
From the creator
Are you using Python's standard logging module? I am, but I found it challenging to understand. It seems this module is difficult not just for me, but for the entire Python community. After exploring several popular libraries released post-ChatGPT, I noticed they all had room for improvement in their logging implementations. In production, I want to log everything to understand my application's behavior thoroughly, but many libraries have idiosyncratic logging that requires hacks from the library user's side... Real-world logging can be quite frustrating! From these experiences, I've become confident in teaching Python logging essentials. To help others avoid my struggles, I'll share the fundamental pattern of Python logging. Since logging is non-functional, it often gets less attention than feature implementation. I hope this talk and materials can provide one solid pattern for combining logging module components (though you're free to choose not to adopt it after understanding it!). Message The logging module contains various elements: Logger, Handler, Formatter, and Filter. I'll demonstrate one pattern for combining these components: Logging implementation in libraries (imported code): - Use Logger (+ NullHandler) Logging implementation in applications (code that imports libraries): - Attach Handler to the root logger - Attach Formatter to the Handler - Set Filter and log levels on the Handler Target Audience - Prerequisite: Experience implementing logging in Python
Published 2026-10-07 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.





