[eluser]Vaibhav132[/eluser]
I am trying to insert the output of the
Code:
$this->output->enable_profiler(TRUE);
into my own log file which i have created in application/logs/profiler.php
I have done following steps for that
1) config.php file
$config['enable_hooks'] = TRUE;
2)in hooks folder created hooks/profiler.php
Code:
function profiler_hook(){
if($_SERVER['REMOTE_ADDR'] == '127.0.0.1'){
$CI =& get_instance();
$CI->output->enable_profiler(TRUE);
}
}
3)Created my own library called "my_profiler".Copied the below code from libraries\Profiler.php
Code:
class My_Profiler extends CI_Profiler {
public function _run(){
$output = "<div id='codeigniter_profiler'>";
$fields_displayed = 0;
foreach ($this->_available_sections as $section)
{
if ($this->_compile_{$section} !== FALSE)
{
$func = "_compile_{$section}";
$output .= $this->{$func}();
$fields_displayed++;
}
}
if ($fields_displayed == 0)
{
$output .= '<p>'.$this->CI->lang->line('profiler_no_profiles').'</p>';
}
$output .= '</div>';
file_put_contents( BASEPATH.'logs/profiler.php', $output);
//return $output;
return '';
}
}
The ERROR !
the $output is not written to the file
logs/profiler.php
It's working for old version.
Any Clue, Why it's not working ?