From a7005638d8b0ea5953e13213045cc3a3ffe4edd7 Mon Sep 17 00:00:00 2001 From: 陆恒 Date: Sat, 9 May 2020 10:51:06 +0800 Subject: [PATCH] 提亀 --- src/HttpServer/main/main.go | 9 +++++++++ 1 file changed, 9 insertions(+), 0 deletions(-) diff --git a/src/HttpServer/main/main.go b/src/HttpServer/main/main.go index 5210ff9..8542079 100644 --- a/src/HttpServer/main/main.go +++ b/src/HttpServer/main/main.go @@ -17,6 +17,13 @@ func InitLogger(file string, lvl int) { logger.New(file, lvl, logger.Rotate{Size: logger.GB, Expired: time.Hour * 24 * 7, Interval: time.Hour * 24}) } +func Selfrecover() { + logger.Info("recover!!!!!!!!") + if err := recover();err!= nil { + logger.Error("Selfrecover,err=%v",err) + } +} + func main() { //defer utils.PrintPanicStack() filename := flag.String("conf_path", "./conf/world.xml", "config file path") @@ -67,6 +74,8 @@ func main() { time.Sleep(time.Duration(2) * time.Second) logic.Testsendhttp() + defer Selfrecover() + select { case _ = <-ch: logger.Info("---I'm done----") -- libgit2 0.21.0