Logging extra fields - hacktlib/py-async-http-logging GitHub Wiki
Extra fields can be logged along with your messages as shown in the example below:
import logging
logger = logging.getLogger()
# Notice the 'extra' argument
logger.error('Ooops, something went wrong', extra={'foo': 'bar'})The dictionary object passed in the extra argument will then compose the log message structure sent to your host[requests anatomy]
For more information, please refer to the Python logging documentation ⧉.
[requests anatomy] Please refer to the Anatomy of POST requests sent to the HTTP host in the documentation. ↩