Closed jellis18 closed 1 year ago
true afaik its not possible to customise logger request fields, but imo if we use something similar to what slog did that would be better... https://pkg.go.dev/golang.org/x/exp/slog#HandlerOptions, since in my latest pr we're switching to slog, all request fields would be of the type Slog.Attr, we can call a function that we take in the config and supply it with each attribute and they can change the attribute key or customise the value...
@Shubhaankar-Sharma a function would work as well to let a user customize the log fields/attrs, I was just wondering if it would be better to keep the interface from the chi-logger middleware.
so, indeed we are phasing out zerolog altogether in favour of "slog"
v2 is out, which includes solution
currently the private
requestLogger
is hardcoded in theHandler
. As far as I can tell this means that you cannot customize the logger request fields.Would it be useful to have the same interface as the chi middleware logger and have the
Handler
take in aLogFormatter
. That way a user could customize the request fields.I'm pretty new to this package so I could be wrong but I'd be happy to make an MR with this change.