You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
441 B
Python

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()