CodeIgniter Pretty Debugging输出

Basically what I want to do is be able to set a switch somewhere: $debugging_mode = 0 or 1 that will allow me to attach a nicely formatted output to the bottom of my views.

I have written a library with a lot going on and I have some output like this:

echo var_dump(array_before_operation);

// do some operations 

echo var_dump(array_after_opertion); 

// do some more stuff 

echo "We have exactly 3 matches!";

My question is what is the cleanest way to get pretty debugging output? ( I am aware of CI's profiler, but I still need something extra )

Where is a good place to set a global debugging mode? I know zend framework has a development or production setting in the .htaccess file, but I don't see that in CI

Should I use PHP's native output buffer to collect my debugging stuff? then how could I append that to the view?

Thanks for your ideas ladies and gents!

global debugging mode: use config class http://codeigniter.com/user_guide/libraries/config.html

cleanest way to get pretty debugging output: text file