function _drush_log

8.0.x drush.inc _drush_log($entry)
7.x drush.inc _drush_log($entry)
master drush.inc _drush_log($entry)

Call the default logger, or the user's log callback, as appropriate.

Related topics

2 calls to _drush_log()
drush_backend_packet_log in includes/drush.inc
Backend command callback. Add a log message to the log history.
drush_log in includes/drush.inc
Add a log message to the log history.

File

includes/drush.inc, line 1275
The drush API implementation and helpers.

Code

function _drush_log($entry) {
  $callback = drush_get_context('DRUSH_LOG_CALLBACK');

  if ($callback instanceof LoggerInterface) {
    $context = $entry;
    $log_level = $entry['type'];
    $message = $entry['message'];
    unset($entry['type']);
    unset($entry['message']);

    $callback->log($log_level, $message, $context);
  }
  elseif ($callback) {
    $log = &drush_get_context('DRUSH_LOG', array());
    $log[] = $entry;
    drush_backend_packet('log', $entry);
    return $callback($entry);
  }
}