From d06ee14e9dd9e0ac20b835bd2f3718498262740b Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Wed, 22 Dec 2021 02:17:30 +0800 Subject: [PATCH] update --- auth/user.go | 2 +- server/middleware.go | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/auth/user.go b/auth/user.go index 5a9cfda..c73cb69 100644 --- a/auth/user.go +++ b/auth/user.go @@ -8,7 +8,7 @@ import ( "gorm.io/gorm" ) -//User User model +// User User model type User struct { ID string `gorm:"primaryKey"` diff --git a/server/middleware.go b/server/middleware.go index db89fe5..c36fdc4 100644 --- a/server/middleware.go +++ b/server/middleware.go @@ -32,10 +32,9 @@ func (srv *Service) Default(c *gin.Context) { c.Abort() cl.Str("error", fmt.Sprint(err)) } - if !util.PROD { - cl.Caller(2) - // cl.Str("trace", util.Stack()) - } + // if !util.PROD { + // cl.Str("trace", util.Stack()) + // } } else if c.Writer.Status() >= 400 { cl = srv.l.Error().Strs("error", c.Errors.Errors()) } else { @@ -47,6 +46,9 @@ func (srv *Service) Default(c *gin.Context) { if usr, ok := c.Get("user"); ok { cl.Str("user", usr.(string)) } + if !util.PROD { + cl.Caller(2) + } cl. Str("method", c.Request.Method). Str("ip", c.ClientIP()).