invl / retry

easy to use retry decorator in python
Other
707 stars 114 forks source link

Cannot be used with loguru. #66

Open kietdev-218 opened 5 months ago

kietdev-218 commented 5 months ago

When I use it: from loguru import logger

@retry(requests.exceptions.RequestException, tries=4, delay=2, logger=logger)

It is not possible to print the complete log like using logging, it only prints the content "%s, retrying in %s seconds..."

daniel-lightlytics commented 5 months ago

+1 The internal call to logger.warning can be convenient at times, but is constraining. Should consider adding a new param for this - to provide a logging function, so the users can decide how to exactly handle retry attempt logging. If I want to intercept the call to use a 3rd party logger which does not support the logger.warning call with the given params, or I want to divert this log to an other log level, I will need to implement a wrapper class for this, instead of, lets say, a local function wrap to delegate this call to my existing logger.