#!/usr/bin/env python3 import functools import logging logger = logging.getLogger(__name__) def invocation_logged(func): @functools.wraps(func) def wrapper(*args, **kwargs): logger.debug(f"Entered {func.__qualname__}") ret = func(*args, **kwargs) logger.debug(f"Exited {func.__qualname__}") return ret return wrapper # Test # @invocation_logged # def f(x): # print(x * x) # return x * x # # q = f(10) # print(q)