Include method being retried
Proposers
- Carlos Natalino (Chalmers)
Description
The RETRY
decorator currently shows a message:
Retry 2/15 after 5.000000 seconds...
However, it would be good to include in this info message which method is being retried so that we can track what is the issue.
Demo or definition of done
Upon having a retry, the message should be, for instance:
Retry [DeviceClient:AddDevice] 2/15 after 5.000000 seconds...
Alternatively, we could add a parameter e.g. verbose
where the info
message would also include a JSON representation of the input parameters. For instance:
Retry [DeviceClient:AddDevice(parameters here)] 2/15 after 5.000000 seconds...
Draft of a solution
In order to show the class and method being retried, we can include the following code in the decorator definition:
python LOGGER.info('Retry [{}.{}] {:d}/{:d} after {:f} seconds...'.format(func.__module__, func.__name__, num_try, max_retries, delay))