def log(text=""):
if isinstance(text,str):
def d(func):
import functools
@functools.wraps(func)
def w(*args,**kw):
print(f'text:{text},func.__name__:{func.__name__},begin call')
result = func(*args,**kw)
print(f'text:{text},func.__name__:{func.__name__},end call')
return result
return w
return d
@functools.wraps(text)
print(f'func.__name__:{text.__name__},begin call')
result = text(*args,**kw)
print(f'func.__name__:{text.__name__},end call')
Sign in to make a reply
欧石楠
def log(text=""):
if isinstance(text,str):
def d(func):
import functools
@functools.wraps(func)
def w(*args,**kw):
print(f'text:{text},func.__name__:{func.__name__},begin call')
result = func(*args,**kw)
print(f'text:{text},func.__name__:{func.__name__},end call')
return result
return w
return d
import functools
@functools.wraps(text)
def w(*args,**kw):
print(f'func.__name__:{text.__name__},begin call')
result = text(*args,**kw)
print(f'func.__name__:{text.__name__},end call')
return result
return w