Skip to content
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

Use lazy % formatting in logging functions #136

Open
OpenBagTwo opened this issue Apr 29, 2024 · 0 comments
Open

Use lazy % formatting in logging functions #136

OpenBagTwo opened this issue Apr 29, 2024 · 0 comments
Labels
tech debt Not a bug yet but could cause issues down the line
Milestone

Comments

@OpenBagTwo
Copy link
Owner

Is your feature request related to a problem? Please describe.

A message that consistently comes up in the PyLint reports is:

W1202: Use lazy % formatting in logging functions (logging-format-interpolation)

There are, apparently, performance reasons for this suggestion, but for me, the primary advantage is that it makes tests much cleaner, e.g. 35854ba#diff-a908114b22e34b7043cbe4670c94a557cff7431a0818027a255607239c96cdb7

The secondary advantage comes when it's time to actually capture and utilize logs (#129), as having the dynamic values separated from the log boilerplate itself simplifies the parsing required.

Describe the solution you'd like

  1. Do a full repo search for logging messages
  2. Where possible, implement dynamic elements of log messages with lazy-formatted arguments
  3. Update tests where possible to check args instead of the formatted message

Describe alternatives you've considered

Not doing this

Additional context

I could have sworn that doing this would break any tests, and that caplog[i].message was just the placeholders without the arguments, but if that was ever the case, it appears to be no longer. 🤷

@OpenBagTwo OpenBagTwo added the tech debt Not a bug yet but could cause issues down the line label Apr 29, 2024
@OpenBagTwo OpenBagTwo added this to the v0.1.7 milestone Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech debt Not a bug yet but could cause issues down the line
Projects
None yet
Development

No branches or pull requests

1 participant