JackDanger · GitHub

logging.Handler and logging.StreamHandler both have useful repr implementations:

>>> import logging
>>> logging.StreamHandler()
<StreamHandler <stderr> (NOTSET)>

But Formatter and Filter don't, so you just get the default unhelpful object repr:

>>> logging.Formatter('%(message)s')
<logging.Formatter object at 0x...>
>>> logging.Filter('myapp')
<logging.Filter object at 0x...>

These should have repr consistent with the existing style, e.g.:

>>> logging.Formatter('%(message)s')
<Formatter (%(message)s)>
>>> logging.Filter('myapp')
<Filter (myapp)>

This would help when inspecting logging configurations in the REPL or debugger.

Linked PRs

Read the original on github.com ↗