import functools def log(option): def dec(func): def swapper(*arg, **karg): functools.update_wrapper(swapper, func) opt = format(option,"^7") print ‘[‘+opt+"] enter",func.__name__ res = func(*arg, **karg) print ‘[‘+opt+‘] exit‘,func.__name__ return res return swapper return dec
时间: 2024-10-10 15:14:18