Skip to main content

Course

Python

PythonPart 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.

Read first: Naming a Piece of Work


Make a free account to read on

Every chapter is free — an account lets your course progress follow you from your laptop to your phone. No payment, no trial.