Repository navigation
ngclient: Use %-style formatting in logging #1400
Description
Activity
- addedgood first issueBite-sized items for first time contributorsBite-sized items for first time contributors
on May 20, 2021 - added a commit that references this issue
on May 21, 2021 - changed the title
[-]experimental client: Use %-style formatting in logging[/-][+]ngclient: Use %-style formatting in logging[/+]on May 25, 2021 - addedbacklogIssues to address with priority for current development goalsIssues to address with priority for current development goals
on May 26, 2021 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...
Reacted by Martin VrachevMy 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 🙂
- removedbacklogIssues to address with priority for current development goalsIssues to address with priority for current development goals
on Jul 7, 2021
(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)