Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Update log formatting so they can be masked if needed #837

Closed
pattisdr opened this issue Jul 8, 2022 · 2 comments · Fixed by #1132
Closed

Update log formatting so they can be masked if needed #837

pattisdr opened this issue Jul 8, 2022 · 2 comments · Fixed by #1132
Assignees
Labels
enhancement New feature or request

Comments

@pattisdr
Copy link
Contributor

pattisdr commented Jul 8, 2022

Is your feature request related to a specific problem?

Reticketed from #831. The "f string" formatting we use across the majority of our logs make them not maskable.

Update logging across the entire application to be a format we can mask and switch logging strategy to be Pii instead of NotPii h/t @eastandwestwind.

Describe the solution you'd like

  • Create a new Pii class and flip the logic to mask if Pii instead of "don't mask if NotPii"
  • Locate the handful of existing logs that currently use %s formatting, whose args are missing the NotPii label and wrap their arguments in Pii. These are the only logs that we've been masking and we want to continue to do so.
  • Switch remaining logs to use % style formatting instead of f-string (154 info logs, 53 warnings, 17 errors).
  • Audit current logs to see if there's anything else whose args should be wrapped withPii (there shouldn't be much. most of our logs don't contain real Pii).
  • Get rid of the NotPii class.

Describe alternatives you've considered, if any

A description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@pattisdr pattisdr added the enhancement New feature or request label Jul 8, 2022
@sanders41
Copy link
Contributor

We should also remove this line in the pyproject.toml file.

Doing this and then running pylint will also point out all the places we need to change the f-string logs.

@pattisdr
Copy link
Contributor Author

pattisdr commented Jul 8, 2022

awesome thanks @sanders41

@pattisdr pattisdr self-assigned this Aug 22, 2022
sanders41 pushed a commit that referenced this issue Aug 24, 2022
* Add a new Pii class and use it to wrap arguments not already wrapped with NonPii in those logs that are currently using %-style formatting.

* Switch logging formatting to %-style instead of f-string.

* Continue to address lingering f string instances, and wrap some arguments in Pii, such as raw exceptions.

* Remove NotPii class and update tests.

* Adjust errors made in %-style conversion.

* Remove accidental Pii on print statements, update some PII wrappings.

* Adjust string formatting of newly added log.

* Update Changelog.

* Fix missed closing curly brackets.

* Remove missed curly brackets.
sanders41 pushed a commit that referenced this issue Sep 22, 2022
* Add a new Pii class and use it to wrap arguments not already wrapped with NonPii in those logs that are currently using %-style formatting.

* Switch logging formatting to %-style instead of f-string.

* Continue to address lingering f string instances, and wrap some arguments in Pii, such as raw exceptions.

* Remove NotPii class and update tests.

* Adjust errors made in %-style conversion.

* Remove accidental Pii on print statements, update some PII wrappings.

* Adjust string formatting of newly added log.

* Update Changelog.

* Fix missed closing curly brackets.

* Remove missed curly brackets.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants