Skip to content

Commit

Permalink
chore: add host info to log.
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Sep 20, 2023
1 parent 7671f52 commit 5a7d049
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/yiwen-ai/auth-api/src/bll"
"github.com/yiwen-ai/auth-api/src/conf"
"github.com/yiwen-ai/auth-api/src/logging"
"github.com/yiwen-ai/auth-api/src/util"
)

Expand Down Expand Up @@ -40,6 +41,7 @@ func newRouters(apis *APIs) []*gear.Router {

router := gear.NewRouter()
router.Use(func(ctx *gear.Context) error {
logging.SetTo(ctx, "host", ctx.Host)
ctxHeader := make(http.Header)
// inject headers into context for base service
util.CopyHeader(ctxHeader, ctx.Req.Header,
Expand Down

0 comments on commit 5a7d049

Please sign in to comment.