import logging # logging config logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') def use_logging(func): def wrapper(*args, **kwargs): logging.info("%s is running" % func.__name__) return func(*args, **kwargs) return wrapper @use_logging def foo(): print("i am foo") @use_logging def bar(): print('i am bar') if __name__ == "__main__": bar() foo()