In this video I show you two ways to create your own context manager which is able to log to a file with a specified header and footer.
Github: https://github.com/r3ap3rpy/python/blob/master/customContext.py
PS: Music if from NCS:https://www.youtube.com/watch?v=PaBwPRa__ic