rs / zerolog

Zero Allocation JSON Logger
MIT License
10.61k stars 572 forks source link

Request: Examples of how to use Zerolog with net/http (hlog) without Alice #279

Open ejstembler opened 3 years ago

ejstembler commented 3 years ago

It would be great if you could provide examples of how to use Zerolog with net/http (hlog) without Alice.

mitar commented 2 years ago

I think in godoc for hlog there is an example without Alice.

hmh commented 1 year ago

Here: https://betterstack.com/community/guides/logging/zerolog/#using-zerologs-net-http-helpers

But read the nearby sections too, you might consider skipping the use of the hlog package to avoid lots of middleware function calls (either nested or in a loop "alice style") depending on your application needs -- although maybe nowadays the golang compiler will notice and unroll them all as inlines and then group-optimize them LTO-style.