log_exception() публичный Метод

Logs PHP generated error messages
public log_exception ( integer $severity, string $message, string $filepath, integer $line ) : void
$severity integer Log level
$message string Error message
$filepath string File path
$line integer Line number
Результат void
Пример #1
0
 /**
  * extend log_exception to add emailing of php errors.
  *
  * @access public
  * @param string $severity
  * @param string $message
  * @param string $filepath
  * @param int $line
  * @return void
  */
 function log_exception($severity, $message, $filepath, $line)
 {
     $ci =& get_instance();
     // this allows different params for different environments
     $ci->config->load('email_php_errors');
     // if it's enabled
     if (config_item('email_php_errors')) {
         // set up email with config values
         $ci->load->library('email');
         $ci->email->from(config_item('php_error_from'));
         $ci->email->to(config_item('php_error_to'));
         // set up subject
         $subject = config_item('php_error_subject');
         $subject = $this->_replace_short_tags($subject, $severity, $message, $filepath, $line);
         $ci->email->subject($subject);
         // set up content
         $content = config_item('php_error_content');
         $content = $this->_replace_short_tags($content, $severity, $message, $filepath, $line);
         // set message and send
         $ci->email->message($content);
         $f = $ci->email->send();
         //var_dump($ci->email);
     }
     // do the rest of the codeigniter stuff
     parent::log_exception($severity, $message, $filepath, $line);
 }
Пример #2
0
 public function log_exception($severity, $message, $filepath, $line)
 {
     if (!($severity & error_reporting())) {
         return;
     }
     if (CUSTOM_ERROR_TRACKING === false) {
         parent::log_exception($severity, $message, $filepath, $line);
     } else {
         $CI =& get_instance();
         $CI->load->library('exceptional');
         $CI->exceptional->createTrace($severity, $message, $filepath, $line);
     }
 }
Пример #3
0
 function log_exception($severity, $message, $filepath, $line)
 {
     parent::log_exception($severity, $message, $filepath, $line);
 }
 function log_exception($severity, $message, $filepath, $line)
 {
     if (($severity & error_reporting()) == $severity) {
         return parent::log_exception($severity, $message, $filepath, $line);
     }
 }
/**
* Exception Handler
*
* This is the custom exception handler we defined at the
* top of this file. The main reason we use this is permit 
* PHP errors to be logged in our own log files since we may 
* not have access to server logs. Since this function
* effectively intercepts PHP errors, however, we also need
* to display errors based on the current error_reporting level.
* We do that with the use of a PHP error template.
*
* @access	private
* @return	void
*/
function _exception_handler($severity, $message, $filepath, $line)
{
    global $config;
    // We don't bother with "strict" notices since they will fill up
    // the log file with information that isn't normally very
    // helpful.  For example, if you are running PHP 5 and you
    // use version 4 style class functions (without prefixes
    // like "public", "private", etc.) you'll get notices telling
    // you that these have been deprecated.
    if ($severity == E_STRICT) {
        return;
    }
    // Send the PHP error to the log file...
    if (!class_exists('CI_Exceptions')) {
        include_once BASEPATH . 'libraries/Exceptions.php';
    }
    $error = new CI_Exceptions();
    // Should we display the error?
    // We'll get the current error_reporting level and add its bits
    // with the severity bits to find out.
    if (($severity & error_reporting()) == $severity) {
        $error->show_php_error($severity, $message, $filepath, $line);
    }
    // Should we log the error?  No?  We're done...
    if ($config['log_errors'] === FALSE) {
        return;
    }
    $error->log_exception($severity, $message, $filepath, $line);
}