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

New style {format} strings in logging calls #7009

Closed
pradyunsg opened this issue Sep 12, 2019 · 6 comments
Closed

New style {format} strings in logging calls #7009

pradyunsg opened this issue Sep 12, 2019 · 6 comments
Labels
state: awaiting PR Feature discussed, PR is needed type: maintenance Related to Development and Maintenance Processes

Comments

@pradyunsg
Copy link
Member

I do wonder if there's some way to make the format strings for logging calls to use the new-style formatting.

Originally posted by @pradyunsg in #6973 (comment)

It'd be nice to be able to switch over TBH.

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Sep 12, 2019
@pradyunsg pradyunsg added state: needs discussion This needs some more discussion type: maintenance Related to Development and Maintenance Processes labels Sep 12, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Sep 12, 2019
@pradyunsg pradyunsg added state: awaiting PR Feature discussed, PR is needed and removed state: needs discussion This needs some more discussion labels Apr 8, 2020
@pradyunsg
Copy link
Member Author

Relabeled, since I think everyone would agree that switching to a single format would be best. :)

@uranusjr
Copy link
Member

uranusjr commented Apr 8, 2020

The logging module can handle brace formatting, but IIRC the conversion needs to be done in one shot, not incrementally.

@McSinyx
Copy link
Contributor

McSinyx commented Apr 8, 2020

Hi there, this seems to have been done in GH-7826, then reverted because of regression (probably due to some minor mistake have to do with implicit use of kwargs, e.g. locals). May I take over this since it's not technically a too difficult task?

@pradyunsg
Copy link
Member Author

Looking at the Python 2 support situation for this change, I think we should wait until Python 2 support is dropped to do this.

@McSinyx
Copy link
Contributor

McSinyx commented Jun 13, 2020

Oops I saw the comment in the PR and reply to it first. There are 2 things needed to be changed:

  • The formatting of messages passed to logger.*, i.e. positional arguments, which can be done now IMHO
  • The formatting of the formatted messages, i.e. the %(field)s -> {field} kind of thing, which must be deferred since it's hardcoded as % in Python 2.

@pradyunsg
Copy link
Member Author

Closing this out. I don’t think we’d be able to do this in the near future. If someone thinks it’s possible, let’s open a new issue instead.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state: awaiting PR Feature discussed, PR is needed type: maintenance Related to Development and Maintenance Processes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants