-
Notifications
You must be signed in to change notification settings - Fork 103
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
For logging, do not use f-strings. Use % for performance reasons etc. #1205
Comments
Hey Reimar, to show you a sample I have added % to the below code. Is this how you wish to have changes in all the .py files https://github.com/engineerrbae/MSS/blob/develop/conftest.py#L189 summary = "\n".join(["PyQt5.QtWidgets.QMessageBox.%s: %s" %(box()._extract_mock_name(),box.mock_calls[:-1]) OR summary = "\n".join(["PyQt5.QtWidgets.QMessageBox.{ }: { }".format(box()._extract_mock_name(),box.mock_calls[:-1]) Once you share I will move ahead with refactoring. Thanks. |
We do want to change only the use of f-string in logging....() to Joern wrote an explanaition copied from #1202 (comment) f-formatting is almost always faster than c-style formatting due to some particularly interesting implementation shenanigans. That is not the point here, however. The idea here is that the formatting will not take place at all in case the logging level is above debug. Using an f-string always does the formatting even if nothing will be output. That can have an detrimental effect on performance with logging disabled. There is a "style" parameter, which can be triggered on a by call basis to use other formatters (e.g. the {} one). See |
Got it. f-string is an expression that is evaluated at runtime and it lacks logging optimizations. Also, logging by default follows % standards & adoption of its default standards going to make the logging fast & accurate & better statistically. Can you share with me the directories wherein logging is part of the files? I will make the changes, please assign me this issue. I will do it. |
Hi The regex I used: After doing these changes you can verify the PEP8 style used in your local clone of the forked repo,see github will do too ;) |
Noted. Thanks a lot. I have started making changes at my end. And, what's the deadline to submit? |
there is no deadline, it may be added to 6.0 or 7.0 |
@ReimarBauer Added % syntax to the logging files. |
i will be taking up this issue |
I want to work on this issue |
…SS#1205 converted all f-strings to % for logging an mentioned in issue Open-MSS#1205
@Ritwikrajsingh have a look on the PR list @DipanshuShukla is already working on this one |
I want to work on this.. please assign me @ReimarBauer |
refactor all logging strings
The text was updated successfully, but these errors were encountered: