I´m extending CodeIgniters core lib (Log) with a better threshold level and a way to mail serious errors. But i can´t read my config file from my library for some reason. If i can´t access my config....i can´t get the email addresses to mail to. What am i doing wrong? The message i get is: "Fatal error: Class 'CI_Controller' not found in..."
This is my code so far:
class MY_Log extends CI_Log {
/**
* Constructor
*
* @access public
*/
function MY_Log()
{
parent::__construct();
$this->_levels = array('ERROR' => '1', 'INFO' => '2', 'DEBUG' => '3', 'ALL' => '4');
}
/**
* Write Log File
*
* Calls the native write_log() method and then sends an email if a log message was generated.
*
* @access public
* @param string the error level
* @param string the error message
* @param bool whether the error is a native PHP error
* @return bool
*/
function write_log($level = 'error', $msg, $php_error = FALSE)
{
$result = parent::write_log($level, $msg, $php_error);
$this->ci =& get_instance();
$this->ci->load->config('myconf/mailconf');
echo $this->ci->config->item('emails');
}
}