gin-contrib / logger

Gin middleware/handler to logger url path using rs/zerolog
MIT License
192 stars 35 forks source link

Minor per-request allocation reduction #65

Closed metaleap closed 12 months ago

metaleap commented 1 year ago

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.

appleboy commented 12 months ago

@metaleap Thanks.