New submission from Andrew Carter <andrewcarter1...@gmail.com>:

Current docs link: 
https://docs.python.org/3/howto/logging-cookbook.html#implementing-structured-logging

GitHub commit link: 
https://github.com/python/cpython/commit/4b88d6c6642450240a9dc22e6efbdc69baf890dd

The suggestion is that for structured logging, a StructuredMessage class should 
be created with a __str__ method defined and then assigned to an _ variable and 
used as a logging formatter.

As the _ variable is commonly used as a "skip variable" and it has other 
meanings inside the Python interactive shell - I recommend that this example is 
changed to one that maybe just defines a simple wrapper function.

I'm happy to create a PR for this - but only if there's agreement that it's 
worthwhile and will get merged if suitable.

Thanks,

Andrew

----------
assignee: docs@python
components: Documentation
messages: 347984
nosy: AndrewCarterUK, docs@python
priority: normal
severity: normal
status: open
title: Don't use _ as a function name in logging documentation cookbook
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37598>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to