function core_watchdog_format_result

8.0.x watchdog.drush.inc core_watchdog_format_result($result, $extended = FALSE)
6.x watchdog.drush.inc core_watchdog_format_result($result, $extended = FALSE)
7.x watchdog.drush.inc core_watchdog_format_result($result, $extended = FALSE)
3.x watchdog.drush.inc core_watchdog_format_result($result, $full = FALSE)
4.x watchdog.drush.inc core_watchdog_format_result($result, $full = FALSE)
5.x watchdog.drush.inc core_watchdog_format_result($result, $full = FALSE)
master watchdog.drush.inc core_watchdog_format_result($result, $extended = FALSE)

Format a watchdog database row.

Parameters

$result: Array. A database result object.

$extended: Boolean. Return extended message details.

Return value

Array. The result object with some attributes themed.

2 calls to core_watchdog_format_result()
drush_core_watchdog_show_many in commands/core/watchdog.drush.inc
Print a table of watchdog messages.
drush_core_watchdog_show_one in commands/core/watchdog.drush.inc
Print a watchdog message.

File

commands/core/watchdog.drush.inc, line 242

Code

function core_watchdog_format_result($result, $extended = FALSE) {
  // Severity.
  $severities = drush_watchdog_severity_levels();
  $result->severity = $severities[$result->severity];

  // Date.
  $result->date = format_date($result->timestamp, 'custom', 'd/M H:i');
  unset($result->timestamp);

  // Message.
  $variables = $result->variables;
  if (is_string($variables)) {
    $variables = unserialize($variables);
  }
  if (is_array($variables)) {
    $result->message = strtr($result->message, $variables);
  }
  unset($result->variables);
  $message_length = 188;

  // Print all the data available
  if ($extended) {
    // Possible empty values.
    if (empty($result->link)) {
      unset($result->link);
    }
    if (empty($result->referer)) {
      unset($result->referer);
    }
    // Username.
    if ($account = user_load($result->uid)) {
      $result->username = $account->name;
    }
    else {
      $result->username = dt('Anonymous');
    }
    unset($result->uid);
    $message_length = PHP_INT_MAX;
  }

  if (drush_drupal_major_version() >= 8) {
    $result->message = Unicode::truncate(strip_tags(Html::decodeEntities($result->message)), $message_length, FALSE, FALSE);
  }
  else {
    $result->message = truncate_utf8(strip_tags(decode_entities($result->message)), $message_length, FALSE, FALSE);
  }

  return $result;
}