I already set my error handler:
set_error_handler (function($errno, $errstr, $errfile, $errline, array $errcontext) {
$s = date('Ymd_His');
switch ($errno)
{
case E_USER_ERROR:
$s.= '_E_';
break;
case E_USER_WARNING:
$s.= '_W_';
break;
case E_USER_NOTICE:
$s.= '_N_';
break;
default:
$s.= '_U_';
break;
}
file_put_contents (APP_PATH_CACHE.'/log'.$s.'_'.rand(1,99999).'.html', print_r(get_defined_vars(), true));
}, E_ALL);
but can it be turn into an exception? So that I could see the flow.