[docs] [issue37598] Don't use _ as a function name in logging documentation cookbook

Andrew Carter report at bugs.python.org
Mon Jul 15 13:11:21 EDT 2019

New submission from Andrew Carter <andrewcarter1992 at 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.



assignee: docs at python
components: Documentation
messages: 347984
nosy: AndrewCarterUK, docs at 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 <report at bugs.python.org>

More information about the docs mailing list