From 0b0a9cdc6a31efa56e688635970c89def918739f Mon Sep 17 00:00:00 2001 From: esrrhs Date: Wed, 13 Nov 2019 16:54:55 +0800 Subject: [PATCH] add --- main.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/main.go b/main.go index 28f6143..742eccc 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,9 @@ package main import ( - "errors" "flag" "fmt" + "github.com/esrrhs/go-engine/src/common" "github.com/esrrhs/go-engine/src/geoip" "github.com/esrrhs/go-engine/src/loggo" "github.com/esrrhs/go-engine/src/pingtunnel" @@ -101,22 +101,7 @@ Usage: func main() { - defer func() { - if r := recover(); r != nil { - var err error - switch x := r.(type) { - case string: - err = errors.New(x) - case error: - err = x - default: - err = errors.New("Unknown panic") - } - if err != nil { - loggo.Error("crash %s", err) - } - } - }() + defer common.CrashLog() t := flag.String("type", "", "client or server") listen := flag.String("l", "", "listen addr")