src/RetrySubscriber.php
public static function createLoggingDelay(
        callable $delayFn,
        LoggerInterface $logger,
        $formatter = null
    ) {
        if (!$formatter) {
            $formatter = new Formatter(self::MSG_FORMAT);
        } elseif (!($formatter instanceof Formatter)) {
            $formatter = new Formatter($formatter);
        }

        return function (
            $retries,
            AbstractTransferEvent $event
        ) use ($delayFn, $logger, $formatter) {
            $delay = $delayFn($retries, $event);
            $logger->log(LogLevel::NOTICE, $formatter->format(
                $event->getRequest(),
                $event->getResponse(),
                $event instanceof ErrorEvent ? $event->getException() : null,
                [
                    'retries' => $retries + 1,
                    'delay'   => $delay
                ] + $event->getTransferInfo()
            ));
            return $delay;
        };
    }
public static function createLoggingDelay(
        callable $delayFn,
        LoggerInterface $logger,
        $formatter = null
    ) {
        if (!$formatter) {
            $formatter = new Formatter(self::MSG_FORMAT);
        } elseif (!($formatter instanceof Formatter)) {
            $formatter = new Formatter($formatter);
        }

        return function (
            $retries,
            AbstractTransferEvent $event
        ) use ($delayFn, $logger, $formatter) {
            $delay = $delayFn($retries, $event);
            $logger->log(LogLevel::NOTICE, $formatter->format(
                $event->getRequest(),
                $event->getResponse(),
                $event instanceof ErrorEvent ? $event->getException() : null,
                [
                    'retries' => $retries + 1,
                    'delay'   => $delay
                ] + $event->getTransferInfo()
            ));
            return $delay;
        };
    }
public static function createLoggingDelay ( callable $ delayFn , LoggerInterface $ logger , $ formatter = null ) { if ( ! $ formatter ) { $ formatter = new Formatter ( self :: MSG_FORMAT ) ; } elseif ( ! ( $ formatter instanceof Formatter ) ) { $ formatter = new Formatter ( $ formatter ) ; } return function ( $ retries , AbstractTransferEvent $ event ) use ( $ delayFn , $ logger , $ formatter ) { $ delay = $ delayFn ( $ retries , $ event ) ; $ logger -> log ( LogLevel :: NOTICE , $ formatter -> format ( $ event -> getRequest ( ) , $ event -> getResponse ( ) , $ event instanceof ErrorEvent ? $ event -> getException ( ) : null , [ 'retries' => $ retries + 1 , 'delay' => $ delay ] + $ event -> getTransferInfo ( ) ) ) ; return $ delay ; } ; }
Creates a delay function that logs each retry before proxying to a
wrapped delay function.

@param callable         $delayFn   Delay function to proxy to
@param LoggerInterface  $logger    Logger used to log messages
@param string|Formatter $formatter Message formatter to format messages

@return callable
Creates a delay function that logs each retry before proxying to a wrapped delay function .