This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients ariebovenberg, docs@python, eric.smith, gregory.p.smith, rhettinger, tinchester, vinay.sajip
Date 2022-02-19.00:28:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645230532.62.0.188315130964.issue46200@roundup.psfhosted.org>
In-reply-to
Content
A new system of logging APIs has been on several of our (core dev and otherwise) minds ever since f-strings were introduced.  For this specific issue, agreed that documentation is key.

The old logging APIs cannot change.  And practically preventing passing non-literal constant values in as the first parameter within their implementation while there are theoretical ways to _maybe_ do that, I expect none would be maintainable or performant.

For https://www.python.org/dev/peps/pep-0675/#logging-format-string-injection, my gut feeling is you want logging functions annotated as is a duality using overload.

```
@overload
def info(str) -> None:
    ...

@overload
def info(msg: LiteralString, *args: object) -> None:
```

As that prevents the untrusted template in msg so you could use a lone f-str.

This larger conversation is better turned into a python-dev or discuss.python.org thread than done in our poor bug tracker as anything more than the doc update and musing around the annotations turns into an evolved logging system design discussion.  (a nice thread internally at work just restarted about this and linked here... people want f-logging!)
History
Date User Action Args
2022-02-19 00:28:52gregory.p.smithsetrecipients: + gregory.p.smith, rhettinger, vinay.sajip, eric.smith, docs@python, tinchester, ariebovenberg
2022-02-19 00:28:52gregory.p.smithsetmessageid: <1645230532.62.0.188315130964.issue46200@roundup.psfhosted.org>
2022-02-19 00:28:52gregory.p.smithlinkissue46200 messages
2022-02-19 00:28:52gregory.p.smithcreate