[eluser]Harold Villacorte[/eluser]
You can just extend the Log class. Here is a quick and dirty:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Extends the CodeIgniter Log class.
*/
class MY_Log extends CI_Log {
/**
* Array of view files that have been loaded.
*
* @var type
*/
public $view_files_loaded = array();
/**
* Write Log File
*
* Generally this function will be called using the global log_message() function
*
* @param string the error level
* @param string the error message
* @param bool whether the error is a native PHP error
* @return bool
*/
public function write_log($level = 'error', $msg, $php_error = FALSE)
{
//------ The extension. Adds view files to the public $view_files_loaded.-//
if (strstr($msg, 'File loaded') && strstr($msg, 'views'))
{
$this->view_files_loaded[] = $msg;
}
//------End extension------------------------------------------------------//
if ($this->_enabled === FALSE)
{
return FALSE;
}
$level = strtoupper($level);
if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold))
{
return FALSE;
}
$filepath = $this->_log_path.'log-'.date('Y-m-d').'.php';
$message = '';
if ( ! file_exists($filepath))
{
$message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
}
if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE))
{
return FALSE;
}
$message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n";
flock($fp, LOCK_EX);
fwrite($fp, $message);
flock($fp, LOCK_UN);
fclose($fp);
@chmod($filepath, FILE_WRITE_MODE);
return TRUE;
}
}
// END MY_Log Class
/* End of file MY_Log.php */
/* Location: ./application/libraries/Log.php */
The $view_files_loaded array would be available anywhere.
Code:
var_dump($this->log->view_files_loaded);
It should be available to the Profiler class as well if you feel like extending that.