o11y-8.x-1.x-dev/modules/o11y_metrics/modules/o11y_metrics_database/src/StackMiddleware/DatabaseLogging.php

modules/o11y_metrics/modules/o11y_metrics_database/src/StackMiddleware/DatabaseLogging.php
<?php

namespace Drupal\o11y_metrics_database\StackMiddleware;

use Drupal\Core\Database\Database;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
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, int $type = self::MAIN_REQUEST, bool $catch = TRUE): Response {
    foreach (array_keys(Database::getAllConnectionInfo()) as $key) {
      Database::startLog('o11y_metrics', $key);
    }
    return $this->httpKernel->handle($request, $type, $catch);
  }

}

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

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