Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete grpclog's Debugf function #7154

Open
dfawley opened this issue Apr 19, 2024 · 3 comments
Open

Delete grpclog's Debugf function #7154

dfawley opened this issue Apr 19, 2024 · 3 comments

Comments

@dfawley
Copy link
Member

dfawley commented Apr 19, 2024

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

@dfawley
Copy link
Member Author

dfawley commented Apr 23, 2024

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.

@atollena
Copy link
Collaborator

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.

@dfawley
Copy link
Member Author

dfawley commented Apr 24, 2024

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 dfawley changed the title Debugf can be misleading Delete grpclog's Debugf function May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants