我正在扩展 CodeIgniters 核心库(日志),具有更好的阈值级别和发送严重错误的方法。但由于某种原因,我无法从我的库中读取我的配置文件。如果我无法访问我的配置....我无法获取邮件地址。我究竟做错了什么?我收到的消息是:“致命错误:在...中找不到类 'CI_Controller'”
到目前为止,这是我的代码:
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');
}
}