This is part two of the four-part series on decorators in Python. Part one of the series can be found here.
In part one of the series, we covered the basics of decorators, what they are, how to use them, and why you should use them. There are many practical applications for decorators in Python. Some are:
This week, we’re going to cover one of them: log functions.
Logging can help better understand how the code executes, and it is often a fundamental way to debug errors.
Debugging[1] means to find and resolve errors within a computer program.
Decorators can be helpful for this; you can create a logger function, and then use it as a decorator for any function you want to be logged.
#decorators #colorama #logging #python-programming #python