Skip to content

Instantly share code, notes, and snippets.

@ayuLiao
Created November 8, 2018 01:37
Show Gist options
  • Select an option

  • Save ayuLiao/5cec49b9d3a998cf65e0b3a12b0270ee to your computer and use it in GitHub Desktop.

Select an option

Save ayuLiao/5cec49b9d3a998cf65e0b3a12b0270ee to your computer and use it in GitHub Desktop.
debug装饰器,使用logger中的方法来输出报错信息,logger在这个软件中同样记录着
def debug(func):
'''
catch error and write in log file
:param func:
:return:
'''
@wraps(func)
def wrapper(*args, **kwargs):
try:
return func(*args,**kwargs)
except Exception,e:
log_debug(traceback.format_exc())
traceback.print_exc()
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment