protected function SyncHealth::getLocalLogMessages in CMS Content Sync 2.1.x
Same name and namespace in other branches
- 8 modules/cms_content_sync_health/src/Controller/SyncHealth.php \Drupal\cms_content_sync_health\Controller\SyncHealth::getLocalLogMessages()
- 2.0.x modules/cms_content_sync_health/src/Controller/SyncHealth.php \Drupal\cms_content_sync_health\Controller\SyncHealth::getLocalLogMessages()
1 call to SyncHealth::getLocalLogMessages()
- SyncHealth::overview in modules/
cms_content_sync_health/ src/ Controller/ SyncHealth.php - Render the overview page.
File
- modules/
cms_content_sync_health/ src/ Controller/ SyncHealth.php, line 184
Class
- SyncHealth
- Provides a listing of Flow.
Namespace
Drupal\cms_content_sync_health\ControllerCode
protected function getLocalLogMessages($levels, $count = 10) {
$result = [];
$connection = $this->database;
$query = $connection
->select('watchdog', 'w')
->fields('w', [
'timestamp',
'severity',
'message',
'variables',
])
->orderBy('timestamp', 'DESC')
->range(0, $count)
->condition('type', 'cms_content_sync')
->condition('severity', $levels, 'IN');
$query = $query
->execute();
$rows = $query
->fetchAll();
foreach ($rows as $res) {
$message = '<em>' . $this->dateFormatter
->format($res->timestamp, 'long') . '</em> ' . self::formatMessage($res)
->render();
$result[] = $message;
}
$result = Helper::obfuscateCredentials($result);
return $result;
}