grpc-go icon indicating copy to clipboard operation
grpc-go copied to clipboard

Delete grpclog's Debugf function

Open dfawley opened this issue 1 year ago • 3 comments

https://github.com/grpc/grpc-go/blob/9cf408ec48fe2b20d020b2430981a148fd93d187/internal/grpclog/prefixLogger.go#L65

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).

dfawley avatar Apr 19 '24 18:04 dfawley

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.

dfawley avatar Apr 23 '24 17:04 dfawley

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.

atollena avatar Apr 24 '24 07:04 atollena

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.

dfawley avatar Apr 24 '24 14:04 dfawley

@dfawley Hi, is it possible for me to contribute to this?

ryuryu08 avatar Jun 17 '24 05:06 ryuryu08

@waganaha66 Feel free to send a PR or let us know if you have questions. Thanks!

aranjans avatar Jun 17 '24 06:06 aranjans