Current Behaviour
Currently node-fetch-retry will console.log or console.error on retry (and other cases), with a specific message. For example here.
Inventory of console.*:
on retry:
on init (config read):
Issue
Apps using node-fetch-try might want a different log message or use a different logging.
For example, they might want to log error details from a specific header or the response body. Currently it only prints the response.statusText in case of a non-success HTTP response.
Apps should be in control and be able to have node-fetch-retry not call console.* at all.
Proposal
Add the option for a custom function onRetry in the retryOptions that would be used instead of the current logging. Signature might follow the usual pattern
function onRetry(response, error) {
// response if response was returned otherwise null
// error if an error was thrown
}
Note sure how to handle the "on init" case, maybe another onInitLog function. Or use the npm debug library (which is off by default).
Current Behaviour
Currently
node-fetch-retrywillconsole.logorconsole.erroron retry (and other cases), with a specific message. For example here.Inventory of
console.*:on retry:
on init (config read):
Issue
Apps using
node-fetch-trymight want a different log message or use a different logging.For example, they might want to log error details from a specific header or the response body. Currently it only prints the
response.statusTextin case of a non-success HTTP response.Apps should be in control and be able to have
node-fetch-retrynot callconsole.*at all.Proposal
Add the option for a custom function
onRetryin theretryOptionsthat would be used instead of the current logging. Signature might follow the usual patternNote sure how to handle the "on init" case, maybe another
onInitLogfunction. Or use the npmdebuglibrary (which is off by default).