function drush_backend_packet_log

8.0.x drush.inc drush_backend_packet_log($entry, $backend_options)
6.x drush.inc drush_backend_packet_log($entry, $backend_options)
7.x drush.inc drush_backend_packet_log($entry, $backend_options)
5.x drush.inc drush_backend_packet_log($entry, $backend_options)
master 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 1311
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'];
  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']) {
    _drush_log($entry);
  }
  else {
    $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);
  }
}