public DbLogController::formatMessage($row)
Formats a database log message.
Parameters
object $row: The record from the watchdog table. The object properties are: wid, uid, severity, type, timestamp, message, variables, link, name.
Return value
string|\Drupal\Core\StringTranslation\TranslatableMarkup|false The formatted log message or FALSE if the message or variables properties are not set.
File
- core/modules/dblog/src/Controller/DbLogController.php, line 344
Class
- DbLogController
- Returns responses for dblog routes.
Namespace
Drupal\dblog\Controller
Code
public function formatMessage($row) { // Check for required properties. if (isset($row->message, $row->variables)) { $variables = @unserialize($row->variables); // Messages without variables or user specified text. if ($variables === NULL) { $message = Xss::filterAdmin($row->message); } elseif (!is_array($variables)) { $message = $this->t('Log data is corrupted and cannot be unserialized: @message', ['@message' => Xss::filterAdmin($row->message)]); } // Message to translate with injected variables. else { $message = $this->t(Xss::filterAdmin($row->message), $variables); } } else { $message = FALSE; } return $message; }
Please login to continue.