FirePHP Logger for Yii Framework
I made this a few weeks ago. It is a Yii Framework extension which routes log messages to FirePHP.
Requirements
- Download the extension from the Yii Framework extension page or GitHub.
- Install Firebug and FirePHP plugins for Firefox.
- Enable output_buffering in php.ini.
Installation
- Download and extract the “shiki” folder to your extensions directory. This is usually “/protected/extensions”.
- Download the FirePHP core class and put it somewhere in your “/protected” directory. I usually put these files in /protected/vendors.
- Modify your config file to include this LogRoute class and set the “fbPath” property to the path of fb.php. Use a Yii alias (i.e. application.vendors.FirePHPCore031.lib.FirePHPCore.fb):
config file code (i.e. /protected/config/main.php)
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
// the default (file logger)
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// the FirePHP LogRoute
array(
'class' => 'ext.shiki.firePHPLogRoute.ShikiFirePHPLogRoute', // "ext" alias points to /protected/extensions
'fbPath' => 'application.vendors.FirePHPCore031.lib.FirePHPCore.fb', // set path to fb.php
),
),
),
....
Usage
Once you’ve got the extension setup in the config, you can use Yii’s logging methods to log messages to FirePHP.
Yii::log(array('username' => 'Shiki', 'profiles' => array('twidl', 'twitter', 'facebook')), CLogger::LEVEL_INFO);
// logging a WARNING message
Yii::log("You didn't setup a profile, are you really a person?", CLogger::LEVEL_WARNING);
// logging with a CATEGORY (categories are displayed as "labels" in FirePHP -- just an additional info text)
Yii::log('Profile successfully created', CLogger::LEVEL_INFO, 'application.user.profiles');
// tracing simple text
Yii::trace('Loading application.user.profiles.ninja', 'application.user.profiles');
// logging an ERROR
Yii::log('We have successfully determined that you are not a person', CLogger::LEVEL_ERROR, 'Any category/label will work');


this is sucks, the php client library is not memcacheD its just ‘memcache’ (without D), if any of you find this fucking D please let me know.