debug_level = $setting['debug']; // Take over from PHP error handling set_error_handler(array($this, 'handle_error')); } // Blah Blah Blah function handle_error($type, $string, $file, $line, $vars) { // Decide which type of error it is, and handle appropriately switch ($type) { // Error type case FATAL: // Select debug level switch ($this->debug_level) { default: case 0: // @todo: intergrate with template class echo 'Error: '.$string.' in '.$file.' on line'. $line.'
'; print_r($var); // Stop application exit; case 1: // @todo: intergrate with template class echo 'There has been an error. Sorry for the inconvenience.'; // Stop application exit; } case ERROR: // @todo: intergrate with template class echo '
ERROR ['.$type.'] '.$string.'
'."
n"; break; case WARNING: // @todo: intergrate with template class echo '
WARNING ['.$type.'] '.$string.'
'."
n"; break; } } } ?>