tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

`before_log` doesn't accept LoggerAdapter - mypy

Open nhtgl opened this issue 2 years ago • 2 comments

Description

mypy is complaining that error: Argument 1 to "before_log" has incompatible type "LoggerAdapter[Logger]"; expected "Logger" [arg-type]

by looking at the implementation

def before_log(logger: "logging.Logger", log_level: int) -> typing.Callable[["RetryCallState"], None]:

Looks like we need to create some type that implements logger interface and check against that rather than against arbitrary types or simply allow logger adapter.

I'm willing to work on this issue. lmk wdyt.

nhtgl avatar Jul 05 '23 10:07 nhtgl

Do you have anything for this ready? / Do you intend to still work on this?

dwreeves avatar Jul 31 '23 20:07 dwreeves

I just wanted to express my readiness to work on this, but I was waiting for maintainers to approve or discuss the idea.

nhtgl avatar Aug 01 '23 09:08 nhtgl