In the middleware handler: the very first init of l zerolog.Logger does not yet depend on the request's c *gin.Context. It need not be allocated at the start of every request, since all later l usage happens anyway only after a new instance is allocated by l.With. With this change, it's inited-and-kept once per gin.Engine.
In the middleware handler: the very first init of
l zerolog.Logger
does not yet depend on the request'sc *gin.Context
. It need not be allocated at the start of every request, since all laterl
usage happens anyway only after a new instance is allocated byl.With
. With this change, it's inited-and-kept once pergin.Engine
.