Skip to content

Instantly share code, notes, and snippets.

@dbowling
Forked from infovore/MY_Exceptions.php
Created December 14, 2011 22:52
Show Gist options
  • Save dbowling/1478947 to your computer and use it in GitHub Desktop.
Save dbowling/1478947 to your computer and use it in GitHub Desktop.
<?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();
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment