#35357: Logger should be able to store extra arguments
-------------------------------------+-------------------------------------
Reporter: Alexander | Owner: nobody
Nestorov |
Type: New | Status: new
feature |
Component: | Version:
Uncategorized | Keywords: logging, logger,
Severity: Normal | extra
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I find myself quite often writing multiple `logger.whatever()` statements
one after another just because I want to log multiple values.
{{{
logger.error("Foo failed. The bar object looked like")
logger.error(bar_object) # bar_object is a deep json-like object
logger.error(f"Retrying with {xyz} thing")
}}}
It would be nice if Django provided a way to log all values passed to
`extra`, like this:
{{{
logger.error("Foo failed. The bar object looked like this. Retrying with
{xyz} thing", extra={
"bar_object": bar_object
})
}}}
I'm aware that I can create a custom logger inheriting from
logging.Handler (or the several other ways this can be achieved), but IMHO
this is such a basic features that it should be included in Django itself.
--
Ticket URL: <https://code.djangoproject.com/ticket/35357>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018eb2be91f9-d1877ce1-7198-49da-a535-56dc01ade21d-000000%40eu-central-1.amazonses.com.