|
Posted by scuniverse@gmail.com on 05/20/06 17:17
Any ideas how to make a email report of all the error messages?
I've read on php.net how to do it the problem is that it sends a email
for each error instead of sending a single email with all the errors.
The code I have thus far (sams as php.net less a few lines I didnt
need):
// user defined error handling function
function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
// timestamp for the error entry
$dt = date("Y-m-d H:i:s");
// define an assoc array of error string
// in reality the only entries we should
// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
// E_USER_WARNING and E_USER_NOTICE
$errortype = array (
E_ERROR => "Error",
E_WARNING => "Warning",
E_PARSE => "Parsing Error",
E_NOTICE => "Notice",
E_CORE_ERROR => "Core Error",
E_CORE_WARNING => "Core Warning",
E_COMPILE_ERROR => "Compile Error",
E_COMPILE_WARNING => "Compile Warning",
E_USER_ERROR => "User Error",
E_USER_WARNING => "User Warning",
E_USER_NOTICE => "User Notice",
);
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<table><tr>";
$err .= "<td>" . $dt . "</td>";
$err .= "<td>" . $errmsg . "</td>";
$err .= "<td>" . $linenum . "</td></tr></table>";
if (in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars,
"Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
// for testing
echo $err;
}
[Back to original message]
|