The Python Papers

The Python Papers

Python 101 - Creating a Logging Decorator

Mike Driscoll's avatar
Mike Driscoll
Aug 11, 2026
∙ Paid

Logging boilerplate can make adding logging to your code more complex. One workaround is to wrap up your logging code in a decorator. Then, you can add a decorator to any functions that you want to add logging to.

This chapter will cover the following topics:

  • What is a decorator?

  • Creating an exception logging decorator

  • Passing a logger to a decorator

You wil…

User's avatar

Continue reading this post for free, courtesy of Mike Driscoll.

Or purchase a paid subscription.
© 2026 Mike Driscoll · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture