Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
class MY_Exceptions extends CI_Exceptions {
function My_Exceptions()
{
parent::CI_Exceptions();
}
function log_exception($severity, $message, $filepath, $line)
{
$CI =& get_instance();
$severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE);
if($CI->config->item('base_url') == 'http://www.production-domain.com/') {
$CI->load->library('email');
$uri = $CI->uri->uri_string();
$CI->email->from('error-donotreply@YOURAPP.com', 'APP Error');
$CI->email->to('youremail@example.org');
$CI->email->subject('APP Error [severity: '.$severity.']');
$CI->email->message('Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line."\n"."From URL: ".$uri);
$CI->email->send();
}
}
}
?>
@andreychernih

This comment has been minimized.

Copy link

commented Apr 3, 2012

This might be a slightly better approach:

https://gist.github.com/2292191

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.