function Log::log

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

Log a query to all active logging keys.

Parameters

\Drupal\Core\Database\StatementInterface $statement: The prepared statement object to log.

array $args: The arguments passed to the statement object.

float $time: The time the query took to execute as a float (in seconds with microsecond precision).

float $start: The time the query started as a float (in seconds since the Unix epoch with microsecond precision).

Deprecated

in drupal:10.1.0 and is removed from drupal:11.0.0. Use ::logFromEvent().

See also

https://www.drupal.org/node/3328053

File

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

Class

Log
Database query logger.

Namespace

Drupal\Core\Database

Code

public function log(StatementInterface $statement, $args, $time, ?float $start = NULL) {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use ::logFromEvent(). See https://www.drupal.org/node/3328053', E_USER_DEPRECATED);
    foreach (array_keys($this->queryLog) as $key) {
        $this->queryLog[$key][] = [
            'query' => $statement->getQueryString(),
            'args' => $args,
            'target' => $statement->getConnectionTarget(),
            'caller' => $this->findCaller(),
            'time' => $time,
            'start' => $start,
        ];
    }
}

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