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.
$full: 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 224
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.
$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 ($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);
$message_length = PHP_INT_MAX;
}
$result->message = truncate_utf8(strip_tags(decode_entities($result->message)), $message_length, FALSE, FALSE);
return $result;
}