feat: recovery logger with ctx (#1601)

Co-authored-by: 曾政 <zengz@weipaitang.com>
pull/1606/head
Evan 3 years ago committed by GitHub
parent ce8ed35c1d
commit f9a132c9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      middleware/recovery/recovery.go

@ -56,7 +56,7 @@ func Recovery(opts ...Option) middleware.Middleware {
buf := make([]byte, 64<<10) //nolint:gomnd buf := make([]byte, 64<<10) //nolint:gomnd
n := runtime.Stack(buf, false) n := runtime.Stack(buf, false)
buf = buf[:n] buf = buf[:n]
logger.Errorf("%v: %+v\n%s\n", rerr, req, buf) logger.WithContext(ctx).Errorf("%v: %+v\n%s\n", rerr, req, buf)
err = op.handler(ctx, req, rerr) err = op.handler(ctx, req, rerr)
} }

Loading…
Cancel
Save