
def logger(fn): |
def wrap(*args,**kwargs): |
"""This is a wrap.""" |
print("before") |
start = datetime.datetime.now() |
ret = fn(*args,**kwargs) |
duration = (datetime.datetime.now() - start).total_seconds() |
print(duration) |
return ret |
copy_properties(fn,wrap) |
return wrap |
@logger |
def add(x,y): |
"""This is a add. |
return int |
x int |
y int |
""" |
print("======call add========") |
time.sleep(2) |
return x + y |



