Skip to main content
Part 5 of 7 · Chapter 4 of 4

Wrapping a Function Without Rewriting It

Adding logging to ten functions usually means editing ten functions. Write the logging once as a decorator, apply it with one line above each function, and leave the original code untouched.

Advanced11 min read

Read first: Naming a Piece of Work


Make a free account to read on

Every chapter is free — an account is how your progress, XP, and streak follow you from your laptop to your phone, and how you show up on the leaderboard. No payment, no trial.