public function Logger::ensureIndexes in MongoDB 8
First index is on <line, timestamp> instead of <function, line, timestamp>, because we write to this collection a lot, and the smaller index on two numbers should be much faster to create than one with a string included.
File
- src/
Logger/ Logger.php, line 88 - Logger functionality (watchdog).
Class
- Logger
- MongoDB logger implementation for watchdog().
Namespace
Drupal\mongodb\LoggerCode
public function ensureIndexes() {
$templates = $this->message_templates;
$indexes = array(
// Index for adding/updating increments.
array(
'line' => 1,
'timestamp' => -1,
),
// Index for admin page without filters.
array(
'timestamp' => -1,
),
// Index for admin page filtering by type.
array(
'type' => 1,
'timestamp' => -1,
),
// Index for admin page filtering by severity.
array(
'severity' => 1,
'timestamp' => -1,
),
// Index for admin page filtering by type and severity.
array(
'type' => 1,
'severity' => 1,
'timestamp' => -1,
),
);
foreach ($indexes as $index) {
$templates
->ensureIndex($index);
}
}