Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2013, 15:23
Avatar de destor77
destor77
 
Fecha de Ingreso: noviembre-2004
Ubicación: Gálvez, Santa Fe, Argentina
Mensajes: 2.654
Antigüedad: 19 años, 6 meses
Puntos: 43
Extender clase Log

hola,
estoy intentando extender la clase log de CI para poder guardar los mensajes en la base de datos. Estoy intentando esto:

Código PHP:
Ver original
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. require_once(SYSDIR.'/core/Controller.php');
  3. class MY_Log extends CI_Log {
  4.  
  5.     public function __construct()
  6.     {
  7.         $this->ci = & get_instance();
  8.         parent::__construct();
  9.     }
  10.     public function write_log($level='error', $msg, $php_error = FALSE){
  11.        
  12.         $result = parent::write_log($level, $msg, $php_error);
  13.        
  14.         $this->ci->load->library('user_agent');
  15.         if ($result == TRUE && strtoupper($level) == 'ERROR') {
  16.              die("si no funciono");
  17.             $user_id = $this->ci->session->userdata('user_id') ? $this->ci->session->userdata('user_id') : '0000';
  18.             $gmtoffset = 60*60*5;
  19.             $post = array(
  20.                 'log_type' => $level,
  21.                 'log_message' => $msg,
  22.                 'log_php_message' => $php_error,
  23.                 'log_ip_origin' => $this->ci->input->ip_address(),
  24.                 'log_user_agent' => $this->ci->agent->agent_string(),
  25.                 'log_date' => date("Y-m-d H:i:s",time() + $gmtoffset),
  26.                 'user_id' => $user_id,
  27.                 'uri_string' => $this->ci->uri->uri_string(),
  28.             );
  29.  
  30.             $this->ci->db->insert('log_erros_system', $post);
  31.         }
  32.        
  33.         return $result;
  34.     }
  35. }

pero me tira este error y no logro evitarlo:
Fatal error: Class 'CI_Controller' not found in C:\xampp\htdocs\poker\system\core\CodeIgniter.php on line 231

alguien le paso lo mismo.
Desde ya muchas gracias