-
Notifications
You must be signed in to change notification settings - Fork 275
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
ngclient: Use %-style formatting in logging #1400
Comments
Remove pylint disable logging-no-lazy, fix remaining non-lazy logging (ngclient/updater.py still contains some but pylint does not notice them: These will be fixed in issue theupdateframework#1400) Signed-off-by: Jussi Kukkonen <[email protected]>
I'd like to give it a try, please? |
Curious: why does Google recommend % over f-strings? I think the latter is far more readable, no? |
I agree, it's just that f-strings get greedily evaluated before logger can check if they are needed: with %-style the logger can check if the string is needed (and usually it isn't) before building the string. Obviously 99% of our logging is nowhere near a critical path where this would matter ... but I'd still like to be able to log inside e.g. a download loop without thinking about it. The other reason would be that our linters complain :) We could of course modify our linter config (and document the style guide difference) but that feels like work too... |
My 0.02 BTC is that we should keep developers not Google/linters/speedtests happy, but that's just me. I will let you guys decide 🙂 |
(this is about code currently in experimental-client/ngclient branch, hopefully soon in develop)
We currently have some f-strings in logging:
Let's use %-style instead in logging (even if f-strings are great for other string formatting, see the google python style guide)
The text was updated successfully, but these errors were encountered: