Elastica\Client::_log PHP Method

_log() protected method

logging.
Deprecation: Overwriting Client->_log is deprecated. Handle logging functionality by using a custom LoggerInterface.
protected _log ( mixed $context )
$context mixed
    protected function _log($context)
    {
        if ($context instanceof ConnectionException) {
            $this->_logger->error('Elastica Request Failure', ['exception' => $context, 'request' => $context->getRequest()->toArray(), 'retry' => $this->hasConnection()]);
            return;
        }
        if ($context instanceof Request) {
            $this->_logger->debug('Elastica Request', ['request' => $context->toArray(), 'response' => $this->_lastResponse ? $this->_lastResponse->getData() : null, 'responseStatus' => $this->_lastResponse ? $this->_lastResponse->getStatus() : null]);
            return;
        }
        $this->_logger->debug('Elastica Request', ['message' => $context]);
    }

Usage Example

Esempio n. 1
0
 protected function _log($context)
 {
     if ($context instanceof Request) {
         $this->_lastRequest = $context;
     }
     parent::_log($context);
 }