Skip to content

Instantly share code, notes, and snippets.

@infovore
Created June 24, 2009 18:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save infovore/135429 to your computer and use it in GitHub Desktop.
Save infovore/135429 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();
}
}
}
?>
@a-chernykh
Copy link

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