protected function setLogHandler(\GuzzleHttp\HandlerStack $handlerStack, callable $logHandler)
    {
        try {
            $handlerStack->after('history', $logHandler, 'logger');
        } catch (\InvalidArgumentException $e) {
            try {
                $handlerStack->before('allow_redirects', $logHandler, 'logger');
            } catch (\InvalidArgumentException $e) {
                $handlerStack->push($logHandler, 'logger');
            }
        }

        return $this;
    }
protected function setLogHandler(\GuzzleHttp\HandlerStack $handlerStack, callable $logHandler)
    {
        try {
            $handlerStack->after('history', $logHandler, 'logger');
        } catch (\InvalidArgumentException $e) {
            try {
                $handlerStack->before('allow_redirects', $logHandler, 'logger');
            } catch (\InvalidArgumentException $e) {
                $handlerStack->push($logHandler, 'logger');
            }
        }

        return $this;
    }
protected function setLogHandler ( \ GuzzleHttp \ HandlerStack $ handlerStack , callable $ logHandler ) { try { $ handlerStack -> after ( 'history' , $ logHandler , 'logger' ) ; } catch ( \ InvalidArgumentException $ e ) { try { $ handlerStack -> before ( 'allow_redirects' , $ logHandler , 'logger' ) ; } catch ( \ InvalidArgumentException $ e ) { $ handlerStack -> push ( $ logHandler , 'logger' ) ; } } return $ this ; }
Add the Log handler to the HandlerStack

@param \GuzzleHttp\HandlerStack $handlerStack
@param callable $logHandler
@return $this
Add the Log handler to the HandlerStack