function Log::logFromEvent

Same name in other branches
  1. 10 core/lib/Drupal/Core/Database/Log.php \Drupal\Core\Database\Log::logFromEvent()

Log a query to all active logging keys, from a statement execution event.

Parameters

\Drupal\Core\Database\Event\StatementExecutionEndEvent $event: The statement execution event.

File

core/lib/Drupal/Core/Database/Log.php, line 111

Class

Log
Database query logger.

Namespace

Drupal\Core\Database

Code

public function logFromEvent(StatementExecutionEndEvent $event) : void {
    foreach (array_keys($this->queryLog) as $key) {
        $this->queryLog[$key][] = [
            'query' => $event->queryString,
            'args' => $event->args,
            'target' => $event->target,
            'caller' => $event->caller,
            'time' => $event->getElapsedTime(),
            'start' => $event->startTime,
        ];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.