Welcome Guest, Not a member yet? Register   Sign In
Writing errors to database / emailing them
#6

[eluser]Unknown[/eluser]
add a table in your database as follows:
Code:
SET FOREIGN_KEY_CHECKS=0;
    -- ----------------------------
    -- Table structure for errores
    -- ----------------------------
    DROP TABLE IF EXISTS `errores`;
    CREATE TABLE `errores` (
      `id` int(11) NOT NULL auto_increment,
      `Severity` varchar(50) default NULL,
      `message` text,
      `filepath` varchar(250) default NULL,
      `line` varchar(250) default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/system/libraries/Exceptions
modify the function log_exception($severity, $message, $filepath, $line) as this:
add the following line:
Code:
$this->log_execption_db($severity, $message, $filepath, $line);

add the function log_execption_db to the system library
Code:
function log_execption_db($severity, $message, $filepath, $line){
        $this->ci =& get_instance();
        $this->ci->load->database();
        
            $data = array(
               'Severity' => $severity ,
               'message' => $message ,
               'filepath' => $filepath,
               'line' => $line
            );

        $this->ci->db->insert('errores', $data);
        
    }

And "ya esta", all the errors will be stored in database too. Also we could create a new confi item in our application to determines if we would like to stored the errors in DB, in file or in both.


Messages In This Thread
Writing errors to database / emailing them - by El Forum - 08-19-2009, 11:35 AM
Writing errors to database / emailing them - by El Forum - 08-19-2009, 12:32 PM
Writing errors to database / emailing them - by El Forum - 08-19-2009, 12:36 PM
Writing errors to database / emailing them - by El Forum - 08-21-2009, 03:43 AM
Writing errors to database / emailing them - by El Forum - 08-21-2009, 03:49 AM
Writing errors to database / emailing them - by El Forum - 11-06-2009, 03:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB