prometheusio_exporter-8.x-1.x-dev/modules/prometheusio_exporter_database/src/StackMiddleware/DatabaseLogging.php

modules/prometheusio_exporter_database/src/StackMiddleware/DatabaseLogging.php
<?php

namespace Drupal\prometheusio_exporter_database\StackMiddleware;

use Drupal\Core\Database\Database;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;

/**
 * Middleware that adds a database logger.
 */
class DatabaseLogging implements HttpKernelInterface {

  /**
   * The decorated kernel.
   *
   * @var \Symfony\Component\HttpKernel\HttpKernelInterface
   */
  protected $httpKernel;

  /**
   * Constructs a WebprofilerMiddleware object.
   *
   * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
   *   The decorated kernel.
   */
  public function __construct(HttpKernelInterface $http_kernel) {
    $this->httpKernel = $http_kernel;
  }

  /**
   * {@inheritDoc}
   */
  public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
    foreach (array_keys(Database::getAllConnectionInfo()) as $key) {
      Database::startLog('prometheusio_exporter', $key);
    }
    return $this->httpKernel->handle($request, $type, $catch);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc