Skip to content

Commit

Permalink
feat: update iris logger
Browse files Browse the repository at this point in the history
  • Loading branch information
miaolz123 committed Jul 1, 2020
1 parent 7162167 commit 79c40ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion iriser/iriser.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ func Register(r router.Party, h interface{}) {
}
}

func NewLogger() iris.Handler {
func NewLogger(ignore func(method, path string) bool) iris.Handler {
cfg := logger.DefaultConfig()
cfg.LogFuncCtx = func(ctx iris.Context, latency time.Duration) {
if ctx.Method() == iris.MethodOptions {
return
}
if ignore != nil && ignore(ctx.Method(), ctx.Path()) {
return
}
fields := log.F{
"method": ctx.Method(),
"path": ctx.Path(),
Expand Down

0 comments on commit 79c40ab

Please sign in to comment.