Skip to content

Commit

Permalink
refactor: pass string format arguments as logging method parameters
Browse files Browse the repository at this point in the history
The logging statement has the call of the form `logging.(format_string % (format_args...))`. For such calls, it is recommended to leave string interpolation to the logging method itself and be written as `logging.(format_string, format_args...)` so that the program may avoid incurring the cost of the interpolation in those cases in which no message will be logged. For more details, see [PEP 282](http://www.python.org/dev/peps/pep-0282).
  • Loading branch information
deepsource-autofix[bot] authored Sep 9, 2023
1 parent 4f4796d commit 076d4c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/biocommons/example/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def main(): # pragma: no cover
)

quote = marvin.get_quote()
_logger.warning("Got quote from Marvin (len=%s)" % (len(quote),))
_logger.warning("Got quote from Marvin (len=%s)", len(quote))

print("Marvin says:")
print(quote)
Expand Down
2 changes: 1 addition & 1 deletion src/biocommons/example/marvin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def get_quote() -> str:

quote = random.choice(quotes)

_logger.info("Got quote from Marvin (len=%s)" % (len(quote),))
_logger.info("Got quote from Marvin (len=%s)", len(quote))

return quote

0 comments on commit 076d4c1

Please sign in to comment.