--- /tmp/civicrm_error/civicrm_error.module 2007-07-24 10:03:20.000000000 +1200 +++ civicrm_error.module 2008-10-22 12:21:38.000000000 +1300 @@ -16,44 +16,45 @@ // civicrm error details if ($civicrm_error) { - $output .= "\n\n***CIVICRM ERROR***\n"; + $output .= "\n\n============================ CIVICRM ERROR ============================\n"; $output .= _civicrm_error_parse_array($civicrm_error); } // php error details if (function_exists('error_get_last')) { - $output .= "\n\n***PHP ERROR***\n"; + $output .= "\n\n============================== PHP ERROR ==============================\n"; $output .= _civicrm_error_parse_array(error_get_last()); } elseif ($php_errormsg) { - $output .= "\n\n***PHP ERROR***\n"; + $output .= "\n\n============================== PHP ERROR ==============================\n"; $output .= _civicrm_error_parse_array($php_errormsg); } // user info global $user; - $output .= "\n\n***USER***\n"; + $output .= "\n\n================================ USER =================================\n"; $output .= _civicrm_error_parse_array($user); // $_SERVER - $output .= "\n\n***SERVER***\n"; + $output .= "\n\n================================ SERVER ===============================\n"; $output .= _civicrm_error_parse_array($_SERVER); // $_REQUEST - $output .= "\n\n***REQUEST***\n"; + $output .= "\n\n=============================== REQUEST ===============================\n"; $output .= _civicrm_error_parse_array($_REQUEST); // backtrace $backtrace = debug_backtrace(); - $output .= "\n\n***BACKTRACE***\n"; + $output .= "\n\n============================== BACKTRACE ==============================\n"; foreach ($backtrace as $call) { - $output .= "**next call**\n"; + $output .= "\n ------------------------------- Next Call -----------------------------\n\n"; $output .= _civicrm_error_parse_array($call); } // send email $subject = 'CiviCRM error at '. $site; $to = variable_get('civicrm_error_to', variable_get("site_mail", ini_get("sendmail_from"))); + watchdog('civicrm_error', '
' . $output . '' ) ; drupal_mail('civicrm_error', $to, $subject, $output); } @@ -62,12 +63,13 @@ * Helper function to return a pretty print of the given array */ function _civicrm_error_parse_array($array) { +// return var_dump( $array ) ; foreach((array)$array as $key => $value) { if (is_array($value) || is_object($value)) { $value = print_r($value, true); } $key = str_pad($key .':', 20, ' '); - $output .= $key . (string)_civicrm_error_check_length($value) ." \n"; + $output .= "\n" . $key . (string)_civicrm_error_check_length($value) . " \n"; } return $output ."\n"; } @@ -80,7 +82,8 @@ return ' '; } if (strlen($item) > 2000) { - $item = substr($item, 0, 2000) .'...'; + $length = strlen($item) ; + $item = substr($item, 0, 2000) .' ... ' . "\n\twas $length chars"; } return $item; }