-
-
Save dbowling/1478947 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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