diff --git a/iriser/iriser.go b/iriser/iriser.go index bebdeaa..ea021aa 100644 --- a/iriser/iriser.go +++ b/iriser/iriser.go @@ -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(),