email - In CodeIgniter, How Can I Have PHP Error Messages Emailed to Me? -


i'd receive error logs via email. example, if warning-level error message should occur, i'd email it.

how can working in codeigniter?

you extend exception core class it.

might have adjust reference ci's email class, not sure if can instantiate library this. don't use ci's email class myself, i've been using swift mailer library. should on right path.

make file my_exceptions.php , place in /application/libraries/ (or in /application/core/ ci 2)

class my_exceptions extends ci_exceptions {      function __construct()     {         parent::__construct();     }      function log_exception($severity, $message, $filepath, $line)      {            if (environment === 'production') {             $ci =& get_instance();              $ci->load->library('email');             $ci->email->from('your@example.com', 'your name');             $ci->email->to('someone@example.com');             $ci->email->cc('another@another-example.com');             $ci->email->bcc('them@their-example.com');             $ci->email->subject('error');             $ci->email->message('severity: '.$severity.'  --> '.$message. ' '.$filepath.' '.$line);             $ci->email->send();         }           parent::log_exception($severity, $message, $filepath, $line);     }  } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -