-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
AnyLogger: TypeAlias = Logger | LoggerAdapter
According to the docs, LoggerAdapter
should look mostly like Logger
. So it would be really nice to have a type that can be used for both Logger
and LoggerAdapter
.
I would need it when I want to hold a logger instance, but I don't really care if it's Logger
or LoggerAdapter
.
So I want to support both options.
It may sound like an antipattern
, according to the docs, but using LoggerAdapter
is the recommended way of passing contextual info (according to the docs).
Even when using contextvars
for holding the logger, a AnyLogger
type would be handy indeed.
I am willing to submit a PR fixing this issue, like I tried to do before:
#126057
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
gee-gendo
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-featureA feature request or enhancementA feature request or enhancement