Refine the directories.

This commit is contained in:
zicla
2019-04-26 02:30:04 +08:00
parent 61b14fe82b
commit b3c52ea50e
40 changed files with 214 additions and 162 deletions

View File

@ -0,0 +1,17 @@
package tool
//带有panic恢复的方法
func PanicHandler() {
if err := recover(); err != nil {
//TODO 全局日志记录
//LOGGER.Error("异步任务错误: %v", err)
}
}
//带有panic恢复的方法
func SafeMethod(f func()) {
defer PanicHandler()
//执行函数
f()
}