firephp-logroute
This extension sends Yii log messages to FirePHP. It inherits from CLogRoute and uses the same method and configuration as the other built-in logging components: CFileLogRoute, CWebLogRoute, etc.
Tested on Yii 1.1.0.
Resources
You can also download from the GitHub page
The FirePHP LogRoute extension for Yii Framework is free software. It is released under the terms of the following BSD License.
Copyright (c) 2010, Shiki (shikishiji@gmail.com). All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of .
Available Downloads
| File | Summary | Uploaded on | Downloaded |
|---|---|---|---|
| shiki-yii-firephplogroute-0.1.2.zip (5.3 KB) | Added skipping if Yii::app()->errorHandler->getError() is not empty and headers were already sent. | March 12, 2010 | 164 |
| shiki-yii-firephplogroute-0.1.1.zip (5.1 KB) | Added an $options property. Yii::trace now just does FB::info(). See http://bit.ly/cHNIuh | March 9, 2010 | 23 |
| shiki-yii-firephplogroute-0.1.zip (6.9 KB) | Initial release | March 7, 2010 | 34 |
March 7, 2010
- Initial release.
FirePHP LogRoute extension for Yii Framework
This extension sends Yii log messages to FirePHP. It inherits from CLogRoute and uses the same method and configuration as the other built-in logging components: CFileLogRoute, CWebLogRoute, etc.
Requirements
- A Yii Framework project
- Install Firebug and FirePHP plugins for Firefox. See http://firephp.org
- Set output_buffering setting to true 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.
// logging an INFO message (arrays will work and looks awesome in 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');
-end-
