diff --git a/logger.go b/logger.go index 16a1de3..c8008ed 100644 --- a/logger.go +++ b/logger.go @@ -57,18 +57,17 @@ func SetLogger(opts ...Option) gin.HandlerFunc { } } + l := zerolog.New(cfg.output). + Output( + zerolog.ConsoleWriter{ + Out: cfg.output, + NoColor: !isTerm, + }, + ). + With(). + Timestamp(). + Logger() return func(c *gin.Context) { - l := zerolog.New(cfg.output). - Output( - zerolog.ConsoleWriter{ - Out: cfg.output, - NoColor: !isTerm, - }, - ). - With(). - Timestamp(). - Logger() - if cfg.logger != nil { l = cfg.logger(c, l) }