def log_it(retry_state): logger.log( log_level, "Starting call to '%s', this is the %s time calling it.", _utils.get_callback_name(retry_state.fn), _utils.to_ordinal(retry_state.attempt_number), )
def log_it(retry_state): logger.log( log_level, log_tpl, _utils.get_callback_name(retry_state.fn), retry_state.seconds_since_start, _utils.to_ordinal(retry_state.attempt_number), )
def log_it(retry_state): if retry_state.outcome.failed: ex = retry_state.outcome.exception() verb, value = 'raised', '%s: %s' % (type(ex).__name__, ex) if exc_info: local_exc_info = get_exc_info_from_future(retry_state.outcome) else: local_exc_info = False else: verb, value = 'returned', retry_state.outcome.result() local_exc_info = False # exc_info does not apply when no exception logger.log(log_level, "Retrying %s in %s seconds as it %s %s.", _utils.get_callback_name(retry_state.fn), getattr(retry_state.next_action, 'sleep'), verb, value, exc_info=local_exc_info)
def warn_about_dunder_non_retry_state_deprecation(fn, stacklevel): msg = ( '"%s" method must be called with' ' single "retry_state" parameter' % (_utils.get_callback_name(fn))) warn(msg, DeprecationWarning, stacklevel=stacklevel + 1)
def warn_about_non_retry_state_deprecation(cbname, func, stacklevel): msg = ( '"%s" function must accept single "retry_state" parameter,' ' please update %s' % (cbname, _utils.get_callback_name(func))) warn(msg, DeprecationWarning, stacklevel=stacklevel + 1)