grpc / grpc-go

The Go language implementation of gRPC. HTTP/2 based RPC

Home Page:https://grpc.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Delete grpclog's Debugf function

dfawley opened this issue · comments

func (pl *PrefixLogger) Debugf(format string, args ...any) {

If a parameter passed to these functions is expensive to evaluate, that expense is borne regardless of whether verbosity would output the message .

All usages should be audited, and we should write another function that allows the arguments to be processed lazily (i.e. pass in closures).

write another function that allows the arguments to be processed lazily (i.e. pass in closures).

Upon further consideration, I don't think this was a good suggestion.

The alternative would be to eliminate prefixlogger Debugf method (which is internal) method and favor Infof gated by if logger.V(2) {}, like we do in most places. The problem is that PrefixLogger doesn't have a V method, and neither has its DepthLogger member.

Yes, that's what I was thinking, too. We could add this method -- worst case, the PrefixLogger can expose it and just call the global logger like it's doing today.