master
Evan Chen 2021-12-22 02:17:30 +08:00
parent 3e574be3c4
commit d06ee14e9d
2 changed files with 7 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import (
"gorm.io/gorm" "gorm.io/gorm"
) )
//User User model // User User model
type User struct { type User struct {
ID string `gorm:"primaryKey"` ID string `gorm:"primaryKey"`

View File

@ -32,10 +32,9 @@ func (srv *Service) Default(c *gin.Context) {
c.Abort() c.Abort()
cl.Str("error", fmt.Sprint(err)) cl.Str("error", fmt.Sprint(err))
} }
if !util.PROD { // if !util.PROD {
cl.Caller(2) // cl.Str("trace", util.Stack())
// cl.Str("trace", util.Stack()) // }
}
} else if c.Writer.Status() >= 400 { } else if c.Writer.Status() >= 400 {
cl = srv.l.Error().Strs("error", c.Errors.Errors()) cl = srv.l.Error().Strs("error", c.Errors.Errors())
} else { } else {
@ -47,6 +46,9 @@ func (srv *Service) Default(c *gin.Context) {
if usr, ok := c.Get("user"); ok { if usr, ok := c.Get("user"); ok {
cl.Str("user", usr.(string)) cl.Str("user", usr.(string))
} }
if !util.PROD {
cl.Caller(2)
}
cl. cl.
Str("method", c.Request.Method). Str("method", c.Request.Method).
Str("ip", c.ClientIP()). Str("ip", c.ClientIP()).