Skip to content

logger: use standard lazy formatting#3487

Merged
efiop merged 1 commit into
treeverse:masterfrom
efiop:3397
Mar 16, 2020
Merged

logger: use standard lazy formatting#3487
efiop merged 1 commit into
treeverse:masterfrom
efiop:3397

Conversation

@efiop
Copy link
Copy Markdown
Contributor

@efiop efiop commented Mar 16, 2020

Unfortunately overriding format is not enough in order to use our own
custom formatting in logger. Record uses percent formatting that is
hardcoded inside, so we would also have to override it, which is just
way too much effort that will inevitably break as we discover other
methods that are not ready for non-% formatting. So we are just giving
up and sticking to default %-formatting for lazy log messages.

Fixes #3397

  • ❗ Have you followed the guidelines in the Contributing to DVC list?

  • 📖 Check this box if this PR does not require documentation updates, or if it does and you have created a separate PR in dvc.org with such updates (or at least opened an issue about it in that repo). Please link below to your PR (or issue) in the dvc.org repo.

  • ❌ Have you checked DeepSource, CodeClimate, and other sanity checks below? We consider their findings recommendatory and don't expect everything to be addressed. Please review them carefully and fix those that actually improve code or fix bugs.

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

Unfortunately overriding `format` is not enough in order to use our own
custom formatting in logger. `Record` uses percent formatting that is
hardcoded inside, so we would also have to override it, which is just
way too much effort that will inevitably break as we discover other
methods that are not ready for non-% formatting. So we are just giving
up and sticking to default %-formatting for lazy log messages.

Fixes treeverse#3397
@efiop efiop merged commit 2ffebb0 into treeverse:master Mar 16, 2020
@efiop efiop deleted the 3397 branch March 16, 2020 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

caplog fails on getting caplog.messages with str.format() log record

1 participant