function drush_backend_packet_log
| 6.x drush.inc | drush_backend_packet_log($entry, $backend_options) |
| 5.x drush.inc | drush_backend_packet_log($entry, $backend_options) |
Backend command callback. Add a log message to the log history.
Parameters
entry: The log entry.
Related topics
File
- includes/
drush.inc, line 1511 - The drush API implementation and helpers.
Code
function drush_backend_packet_log($entry, $backend_options) {
if (!$backend_options['log']) {
return;
}
if (!is_string($entry['message'])) {
$entry['message'] = implode("\n", (array) $entry['message']);
}
$entry['message'] = $entry['message'];
$log = &drush_get_context('DRUSH_LOG', array());
$log[] = $entry;
// Yes, this looks odd, but we might in fact be a backend command
// that ran another backend command.
drush_backend_packet('log', $entry);
if (array_key_exists('#output-label', $backend_options)) {
$entry['message'] = $backend_options['#output-label'] . $entry['message'];
}
// If integrate is FALSE, then log messages are stored in DRUSH_LOG,
// but are -not- printed to the console.
if ($backend_options['integrate']) {
$callback = drush_get_context('DRUSH_LOG_CALLBACK', '_drush_print_log');
return $callback($entry);
}
}