Created
November 8, 2018 01:37
-
-
Save ayuLiao/5cec49b9d3a998cf65e0b3a12b0270ee to your computer and use it in GitHub Desktop.
debug装饰器,使用logger中的方法来输出报错信息,logger在这个软件中同样记录着
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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