function Log::log

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

Log a query to all active logging keys.

Parameters

$statement: The prepared statement object to log.

$args: The arguments passed to the statement object.

$time: The time in milliseconds the query took to execute.

File

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

Class

Log
Database query logger.

Namespace

Drupal\Core\Database

Code

public function log(StatementInterface $statement, $args, $time) {
    foreach (array_keys($this->queryLog) as $key) {
        $this->queryLog[$key][] = [
            'query' => $statement->getQueryString(),
            'args' => $args,
            'target' => $statement->dbh
                ->getTarget(),
            'caller' => $this->findCaller(),
            'time' => $time,
        ];
    }
}

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