go-chi / httplog

Go HTTP request logger with structured logging capabilities built on "log/slog" package
MIT License
207 stars 42 forks source link

httplog Configure sets global zerolog configuration #12

Closed Goldziher closed 1 year ago

Goldziher commented 2 years ago

Hi there,

I spent several hours trying to figure an issue with zerolog, which i reported here - https://github.com/rs/zerolog/issues/434, and which I eventually traced to the fact that httplog.NewLogger, via httplog.Configure sets global zerolog configurations.

This is a problem - in my use case go-chi is used to expose some webhooks from an application that is not a rest API primarily, but also in other cases the user may not want to use the httplog logger throughout the application but rather import directly from github.com/rs/zerolog/log or create an application specific logger in a logger package. Furthermore, its completely obfuscated that this is happening, leading to a very annoying and complex debug process.

I would therefore like to request / suggest that httplog removes the global configuration, which from my PoV are completely unnecessary there.

anuarkaliyev23 commented 1 year ago

Confirming, this issue still exists in v5.0.8

pkieltyka commented 1 year ago

solved in v2