Program - attach function closure with logs details to another function


Topic: Program - attach function closure with logs details to another function

Solution

def attach_log(fn: "function"):
    def inner(*args, **kwargs):
        dt = datetime.now()
        print(f'{fn.__name__} is called at {dt} with {args} {kwargs} ')
        return fn(*args, **kwargs)
    return inner



List all Python Programs