function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars){
$dt = date("Y-m-d H:i:s (T)");
$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",
E_STRICT => "Runtime Notice"
);
//$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$drop_errors = array( E_NOTICE, E_STRICT );
if (in_array($errno, $drop_errors)) return true; // tyto chyby preskakujeme
// if ($errno == E_USER_ERROR) { mail("phpdev@example.com", "Critical User Error", $err);
// tady mozno specialni pripady treba mailovat atd....
$err=$dt.' '.$errortype[$errno].':'
.$filename.':'.$linenum.')'."n"
.$errmsg."n"
.$_SERVER['REQUEST_URI']."n"
.$_SERVER['HTTP_USER_AGENT']."n";
error_log(strip_tags($err));
}
set_error_handler("userErrorHandler"); |