function drush_error_handler

8.0.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
6.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
7.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
3.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
4.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
5.x environment.inc drush_error_handler($errno, $message, $filename, $line, $context)
master environment.inc drush_error_handler($errno, $message, $filename, $line, $context)

Log PHP errors to the Drush log. This is in effect until Drupal's error handler takes over.

1 string reference to 'drush_error_handler'
drush.php in ./drush.php
drush is a PHP script implementing a command line shell for Drupal.

File

includes/environment.inc, line 278
Functions used by drush to query the environment and setting the current configuration.

Code

function drush_error_handler($errno, $message, $filename, $line, $context) {
  // If the @ error suppression operator was used, error_reporting will have
  // been temporarily set to 0.
  if (error_reporting() == 0) {
    return;
  }

  if ($errno & (E_ALL)) {
    // By default we log notices.
    $type = drush_get_option('php-notices', 'notice');

    // Bitmask value that constitutes an error needing to be logged.
    $error = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR;
    if ($errno & $error) {
      $type = 'error';
    }

    // Bitmask value that constitutes a warning being logged.
    $warning = E_WARNING | E_CORE_WARNING | E_COMPILE_WARNING | E_USER_WARNING;
    if ($errno & $warning) {
      $type = 'warning';
    }

    drush_log($message . ' ' . basename($filename) . ':' . $line, $type);

    return TRUE;
  }
}