You are here

class RequestLogger in Search API Elasticsearch 8

Class QueryLogger @package Drupal\search_api_elasticsearch\Logger

Hierarchy

Expanded class hierarchy of RequestLogger

1 file declares its use of RequestLogger
Client.php in src/Elastica/Client.php

File

src/Logger/RequestLogger.php, line 12

Namespace

Drupal\search_api_elasticsearch\Logger
View source
class RequestLogger implements LoggerInterface {
  use RfcLoggerTrait;

  /**
   * @param LoggerInterface $logger
   * @param bool $debug
   */
  public function __construct(LoggerInterface $logger = null, $debug = false) {
    $this->logger = $logger;
    $this->debug = $debug;
  }

  /**
   * @param $path
   * @param $method
   * @param $data
   * @param array $connection
   * @param array $query
   */
  public function logQuery($path, $method, $data, $connection = array(), $query = array()) {
    if ($this->debug) {
      $this->queries[] = array(
        'path' => $path,
        'method' => $method,
        'data' => $data,
        'connection' => $connection,
        'queryString' => $query,
      );
    }
    if ($this->logger !== null) {
      $message = sprintf("%s (%s)", $path, $method);
      $this->logger
        ->info($message, (array) $data);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function log($level, $message, array $context = array()) {
    return $this->logger
      ->log($level, $message, $context);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RequestLogger::log public function Overrides RfcLoggerTrait::log
RequestLogger::logQuery public function
RequestLogger::__construct public function
RfcLoggerTrait::alert public function
RfcLoggerTrait::critical public function
RfcLoggerTrait::debug public function
RfcLoggerTrait::emergency public function
RfcLoggerTrait::error public function
RfcLoggerTrait::info public function
RfcLoggerTrait::notice public function
RfcLoggerTrait::warning public function