JonoB
JonoB

Reputation: 5887

CodeIgniter output to profiler

Is it possible to output custom data to the CI profiler?

I tried

$this->output->append_output($var); 

But this seems to be similar to an echo, as it appears at the top of the page.

Is there a way to get this to appear with the rest of the profiling info?

Upvotes: 0

Views: 1703

Answers (2)

Cipars
Cipars

Reputation: 11

There are two ways you can set which sections you want to show

1.Add this to controller method which you want to profile:

$sections = array(
'config'  => TRUE,
'queries' => TRUE
);

$this->output->set_profiler_sections($sections);
$this->output->enable_profiler(TRUE);

2.In application/config/profiler.php set application wide defaults:

$config['config'] = FALSE;
$config['queries'] = FALSE;

Here is list of all available sections: (by the way this can be found under system/libraries/profiler.php

'benchmarks',
'get',
'memory_usage',
'post',
'uri_string',
'controller_info',
'queries',
'http_headers',
'session_data',
'config'

Upvotes: 0

Teej
Teej

Reputation: 12883

Extend the profiler class:

class MY_Profiler extends CI_Profiler {

    function _do_stuff() {
        //do stuff
    }

    //In the run method add your method
    function run() {
        $this->_do_stuff();
    }

}

This is something from my blog: http://pinoytech.org/blog/post/Add-SESSIONS-to-Profiler-in-CodeIgniter

Upvotes: 1

Related Questions