Welcome Guest, Not a member yet? Register   Sign In
FirePHP & CodeIgniter
#1

[eluser]NateL[/eluser]
I found the FirePHP4CI in the wiki - but is there any documentation or breif tutorials? Did a quick search and didn't come up with much Sad Is it even working with CI 1.7.1 ?
#2

[eluser]pmoroom[/eluser]
I have it and it works fine. What are you wanting to know?
#3

[eluser]NateL[/eluser]
Found pretty much exactly what I was looking for..

http://www.firephp.org/Wiki/Libraries/CodeIgniter
#4

[eluser]zbrox[/eluser]
I've some problems making it work without manually loading or autoloading it. The MY_Controller file should do that, I guess but something doesn't work for me...
#5

[eluser]jedd[/eluser]
Yup, I got it working (mostly okay) and then sort of lost interest in it. I recall there was an issue with the ob_flush stuff .. but can't recall the details.

I hope that helps. Haha. Erhm.
#6

[eluser]Tobz[/eluser]
Hi Everyone,

I found the firephp library to be a bit bloated. so I made my own for CI(it could be adapted quite easily)
It doesn't support the full firephp functionality - but it does support anything I've ever used so...

here it is:

Code:
/*
Usage:

$this->load->library('console');
$this->console->log(array('foo'=>'bar'));

*/
<?php
class Console {
    
    public $enabled = true;
    private $index = 1;
    private $CI;

  function Console($enable=true) {
      $this->CI =& get_instance();
        $this->enabled = $enable;
  }
    
    /**
     * Log data to the fireBug Console (via firePHP)
     * @param Mixed $type
     * @param Mixed $message
     * @param Bool $write_to_file [optional]
     */
    function log($message, $type='log', $write_to_file=false) {
        $header_name = 'X-Wf-1-1-1-'.$this->index;
        
        if (!is_array($type) && !is_object($type)) {
            if (in_array(strtolower($type), array('log','info','warn','error'))) {
                // create header value
                $header_value = '[{"Type":"'.strtoupper($type).'"},'.json_encode($message).']';
                if ($write_to_file==true) {
                    log_message($type, $message);
                }
            }
        }
        else {
            $meta;
            // create meta Object
            foreach ($type as $key=>$value) {
                $key = ucfirst($key);
                $meta->$key = $value;
            }

            $body;
            // create body object
            foreach ($message as $key=>$value) {
                $key = ucfirst($key);
                $body->$key = $value;
            }
            // create header value
            $header_value = '['.json_encode($meta).','.json_encode($body).']';
            
            if ($write_to_file==true) {
                log_message($meta->Type, $body->Trace.': '.json_decode($body->Trace));
            }
        }
        
        if ($this->enabled) {
            if ($this->index==1) {
                // set base firePHP headers
                $this->CI->output->set_header('X-Wf-Protocol-1: http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
                $this->CI->output->set_header('X-Wf-1-Plugin-1: http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3');
                $this->CI->output->set_header('X-Wf-1-Structure-1: http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
            }
            
            // set output header
            $this->CI->output->set_header($header_name.': '.strlen($header_value).'|'.$header_value.'|');
            
            // increase log index
            $this->index++;
        }
    }
}

/* End of file console.php */
/* Location: application/libraries/console.php */




Theme © iAndrew 2016 - Forum software by © MyBB