if (empty(self::
$logs[$key])) { self::
$logs[$key] =
new Log($key);
// Every target already active for this connection key needs to have the
// logging object associated with it.
if (!
empty(self::
$connections[$key])) { foreach (self::
$connections[$key] as $connection) { $connection->
enableEvents([ StatementExecutionStartEvent::
class,
StatementExecutionEndEvent::
class,
]);
$connection->
setLogger(self::
$logs[$key]);
} } } self::
$logs[$key]->
start($logging_key);
return self::
$logs[$key];
} /**
* 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.
*
* @param string $logging_key
* The logging key to log.
* @param string $key
* The database connection key for which we want to log.
*
* @return array
* The query log for the specified logging key and connection.
*
* @see \Drupal\Core\Database\Log
*/