function core_watchdog_format_result
| 6.x watchdog.drush.inc | core_watchdog_format_result($result, $full = FALSE) |
| 5.x watchdog.drush.inc | core_watchdog_format_result($result, $full = 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) |
Format a watchdog database row.
Parameters
$result: Array. A database result object.
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 214
Code
function core_watchdog_format_result($result, $full = FALSE) {
// Severity.
drush_include_engine('drupal', 'environment');
$severities = core_watchdog_severity_levels();
$result->severity = $severities[$result->severity];
// Date.
$result->date = format_date($result->timestamp, 'custom', 'd/M H:i');
unset($result->timestamp);
// Message.
if (drush_drupal_major_version() > 5) {
$variables = unserialize($result->variables);
if (is_array($variables)) {
$result->message = strtr($result->message, $variables);
}
unset($result->variables);
}
$result->message = truncate_utf8(strip_tags(decode_entities($result->message)), 188, FALSE, FALSE);
// This data is only used in a detailed view.
if ($full) {
// 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);
}
return $result;
}