-
Notifications
You must be signed in to change notification settings - Fork 111
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
BF: RF f-string uses in logger to %-interpolations #6886
Conversation
Codecov Report
@@ Coverage Diff @@
## maint #6886 +/- ##
==========================================
+ Coverage 90.25% 91.21% +0.95%
==========================================
Files 354 354
Lines 46116 46116
==========================================
+ Hits 41622 42064 +442
+ Misses 4494 4052 -442
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. The performance aspect is also not to be forgotten.
datalad/cmd.py
Outdated
self.return_code = self.generator.return_code | ||
self.runner = None | ||
|
||
except CommandError as command_error: | ||
# The command exited with a non-zero return code | ||
lgr.error(f"{self}: command error: {command_error}") | ||
lgr.error("%s: command error: command_error", self, command_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dang, I did I screw up here, travis picked it up in https://app.travis-ci.com/github/datalad/datalad/jobs/577595841#L3864
f-strings should not be used for logger since if any of the .format-ed content contains some %, it would then be incorrectly or causing a crash %-polated by the logger. Although some of the "fixed" cases would be ok (we know that it was an int etc) for consistency and to avoid needed "is this particular use safe?" checks, better to avoid f-strings in logger in general
b5edd7c
to
564027c
Compare
f-strings should not be used for logger since if any of the .format-ed
content contains some %, it would then be incorrectly or causing a crash
%-polated by the logger. Although some of the "fixed" cases would be ok
(we know that it was an int etc) for consistency and to avoid needed
"is this particular use safe?" checks, better to avoid f-strings in
logger in general