tenacity
tenacity copied to clipboard
`before_sleep_log` logs "<unknown>"
When running code similar to the "Retrying code block" example and using the before_sleep_log
function, the logged line includes "
Seems like this comment is untrue: https://github.com/jd/tenacity/blob/99e7482e8b027f0521315e0f7830a0badae5c561/tenacity/before_sleep.py#L60
running 8.2.3
I guess the comment dates from the time when only the function decorator was available.
That was my assumption too.
I had a quick scan of the code and I couldn't see a nice way to be able to name the retry block so that this log would print something more useful.
#455
@christopher5106 @geuben As a workaround, just use attempt.retry_state.fn = func_name
(or self.func_name
) inside with attempt:
and it should work as expected. 👍