From 764d88894ed7b778fdf49697df2f6ae2fcbb7bfe Mon Sep 17 00:00:00 2001 From: hoteas Date: Sat, 29 May 2021 00:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=09=E5=AE=8C=E5=96=84error=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/main.go | 3 +++ log/logrus.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/example/main.go b/example/main.go index a601e37..355a971 100644 --- a/example/main.go +++ b/example/main.go @@ -2,6 +2,7 @@ package main import ( "../../hotime" + "errors" "fmt" "golang.org/x/net/websocket" "time" @@ -45,6 +46,7 @@ func main() { // return DB, nil //}) //init + appIns.Run(hotime.Router{ "app": hotime.Proj{ "index": hotime.Ctr{ @@ -54,6 +56,7 @@ func main() { fmt.Println(this.Session("test").ToCeilInt()) this.Session("test1", 98984984) fmt.Println(this.Session("test1").Data) + this.Error.SetError(errors.New("dasdasdas")) //fmt.Println(this.Db.GetTag()) //this.Application.Log.Error("dasdasdas") //this.Log.Error("dadasdasd") diff --git a/log/logrus.go b/log/logrus.go index acf8996..01d09a3 100644 --- a/log/logrus.go +++ b/log/logrus.go @@ -82,6 +82,10 @@ func findCaller(skip int) string { for i := 0; i < 10; i++ { file, line = getCaller(skip + i) if !strings.HasPrefix(file, "logrus") { + + if file == "common/error.go" { + file, line = getCaller(skip + i + 1) + } break } }