final public static function Database::getLog

final public static Database::getLog($logging_key, $key = 'default')

Retrieves the queries logged on for given logging key.

This method also ends logging for the specified key. To get the query log to date without ending the logger request the logging object by starting it again (which does nothing to an open log key) and call methods on it as desired.

Parameters

string $logging_key: The logging key to log.

string $key: The database connection key for which we want to log.

Return value

array The query log for the specified logging key and connection.

See also

\Drupal\Core\Database\Log

File

core/lib/Drupal/Core/Database/Database.php, line 130

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

final public static function getLog($logging_key, $key = 'default') {
  if (empty(self::$logs[$key])) {
    return NULL;
  }
  $queries = self::$logs[$key]->get($logging_key);
  self::$logs[$key]->end($logging_key);
  return $queries;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Database.php/function/Database::getLog/8.1.x