diff options
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/includes/common.inc b/includes/common.inc index bc9cac4eb..da0e588fc 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -390,15 +390,19 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = */ /** - * Log errors in the database rather than displaying them to the user. + * Log errors as defined by administrator + * Error levels: + * 1 = Log errors to database. + * 2 = Log errors to database and to screen. */ function error_handler($errno, $message, $filename, $line, $variables) { - $types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning'); - $entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.'; + if ($errno & E_ALL ^ E_NOTICE) { + $types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning'); + $entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.'; - if ($errno & (E_ALL ^ E_NOTICE)) { watchdog('error', t('%error: %message in %file on line %line.', array('%error' => $types[$errno], '%message' => $message, '%file' => $filename, '%line' => $line))); - if (error_reporting()) { + + if (variable_get('error_level', 1) == 1) { print '<pre>'. $entry .'</pre>'; } } |