Error handler

In other projects (not Elgg) we sometime use the following error handler.

Could yo please advise how to do it in Elgg?

My Elgg version 2.3.13

Thank you very much



define('LIVE', FALSE);// website in development mode 

//define('LIVE', TRUE);// website in live mode 

//  the error handler:
function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) {
     $message = "An error occurred in script '$e_file' on line $e_line: $e_message\n";

     $message .= print_r ($e_vars, 1);

     if (!LIVE) { // Development (print the error).

       echo '<pre>' . $message . "\n";

       echo '</pre><br />';

     } else { // LIVE - Don't show the error.

       echo '<div style=" etc. ">A system error occurred. We apologize for the       inconvenience.<br />Please try to refresh the page.<br />If the error persists, please contact the webmaster.</div>';


set_error_handler ('my_error_handler');