コード例 #1
0
ファイル: Render.php プロジェクト: sgdoc/sgdoce-codigo
    /**
     * @return string
     */
    public function toHTML()
    {
        \Zend_Wildfire_Plugin_FirePhp::send($this->_root, 'DEBUG', \Zend_Wildfire_Plugin_FirePhp::WARN);
        $html = <<<HTML
<ul>
    <li>201500000000
        <ul>
            <li>
                <b>
                    <i>20150000001</i>
                </b>
                <ul>
                    <li>20150000002</li>
                </ul>
            </li>
            <li>20150000003</li>
            <li>20150000004
                <ul>
                    <li>20150000005
                        <li>20150000006
                            <ul>
                                <li>20150000007</li>
                            </ul>
                        </li>
                    </li>
                </ul>
            </li>
            <li>20150000008</li>
        </ul>
    </li>
</ul>
HTML;
        return $html;
    }
コード例 #2
0
 public function __construct()
 {
     $this->_message = new \Zend_Wildfire_Plugin_FirePhp_TableMessage('Doctrine Queries');
     $this->_message->setBuffered(true);
     $this->_message->setHeader(array('Time', 'Event', 'Parameters'));
     $this->_message->setOption('includeLineNumbers', false);
     \Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message, 'Doctrine Queries');
 }
コード例 #3
0
 public function tearDown()
 {
     if (extension_loaded('pdo_sqlite')) {
         $this->_db->getConnection()->exec('DROP TABLE foo');
     }
     Zend_Wildfire_Channel_HttpHeaders::destroyInstance();
     Zend_Wildfire_Plugin_FirePhp::destroyInstance();
 }
コード例 #4
0
 public function tearDown()
 {
     if (extension_loaded('pdo_sqlite') && class_exists('Doctrine_Core')) {
         Doctrine_Manager::connection()->getDbh()->exec('DROP TABLE accounts');
     }
     // unregister doctrine namespace
     Zend_Loader_Autoloader::getInstance()->unregisterNamespace('Doctrine_');
     Zend_Wildfire_Channel_HttpHeaders::destroyInstance();
     Zend_Wildfire_Plugin_FirePhp::destroyInstance();
 }
コード例 #5
0
 public function testgroupedloggingAction()
 {
     $logger = Zend_Registry::get('logger');
     Zend_Wildfire_Plugin_FirePhp::group("Collapsed Group", array('Collapsed' => true));
     $logger->log('Message in collapsed group', Zend_Log::DEBUG);
     Zend_Wildfire_Plugin_FirePhp::groupEnd();
     Zend_Wildfire_Plugin_FirePhp::group("Expanded Group", array('Collapsed' => false));
     $logger->log('Message in expanded group', Zend_Log::DEBUG);
     Zend_Wildfire_Plugin_FirePhp::groupEnd();
 }
コード例 #6
0
 public function testgroupsAction()
 {
     Zend_Wildfire_Plugin_FirePhp::group('Group 1');
     Zend_Wildfire_Plugin_FirePhp::send('Test Message 1');
     Zend_Wildfire_Plugin_FirePhp::group('Group 2');
     Zend_Wildfire_Plugin_FirePhp::send('Test Message 2', 'Label', Zend_Wildfire_Plugin_FirePhp::INFO);
     Zend_Wildfire_Plugin_FirePhp::groupEnd();
     Zend_Wildfire_Plugin_FirePhp::send('Test Message 3');
     Zend_Wildfire_Plugin_FirePhp::groupEnd();
 }
コード例 #7
0
ファイル: Firebug.php プロジェクト: sgdoc/sgdoce-codigo
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     $this->_label = 'SQLs SGDOC-e';
     $this->_message = new FirePhp_TableMessage('Doctrine2 Queries');
     $this->_message->setBuffered(true);
     $this->_message->setHeader(array('Time', 'Event', 'Parameters'));
     $this->_message->setOption('includeLineNumbers', false);
     $this->_setCriticalQueriesLogger();
     FirePhp::getInstance()->send($this->_message);
 }
コード例 #8
0
ファイル: class.profiler.php プロジェクト: Tony133/zf-web
 /**
  *
  * @param boolean $enable
  */
 public function setEnabled($enable)
 {
     parent::setEnabled($enable);
     if ($enable) {
         $this->_message = new TableMessage($this->label);
         $this->_message->setBuffered(true);
         $this->_message->setHeader(array('Time', 'Event', 'Parameters', 'Results'));
         $this->_message->setDestroy(true);
         Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message);
     }
 }
コード例 #9
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $conn = Doctrine_Manager::connection();
     $conn->setListener($this->profiler = new Doctrine_Connection_Profiler());
     // setup firebug
     $this->message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->label);
     $this->message->setBuffered(true);
     $this->message->setHeader(array('Time', 'Event', 'Parameters'));
     $this->message->setDestroy(true);
     $this->message->setOption('includeLineNumbers', false);
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->message);
 }
コード例 #10
0
ファイル: Firebug.php プロジェクト: esironal/kebab-project
 /**
  * Constructor
  *
  * @param string $label OPTIONAL Label for the profiling info.
  * @return void
  */
 public function __construct($label = null)
 {
     $this->_label = $label;
     if (!$this->_label) {
         $this->_label = 'Imind_Profiler_Doctrine_Firebug';
     }
     if (!$this->_message) {
         $this->_message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_label);
         $this->_message->setBuffered(true);
         $this->_message->setHeader(array('Name', 'Time', 'Event', 'Parameters'));
         $this->_message->setDestroy(true);
         Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message);
     }
 }
コード例 #11
0
ファイル: Firebug.php プロジェクト: mway08/openslopeone
 /**
  * Enable or disable the profiler.  If $enable is false, the profiler
  * is disabled and will not log any queries sent to it.
  *
  * @param  boolean $enable
  * @return Zend_Db_Profiler Provides a fluent interface
  */
 public function setEnabled($enable)
 {
     parent::setEnabled($enable);
     if ($this->getEnabled()) {
         if (!$this->_message) {
             $this->_message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_label);
             $this->_message->setBuffered(true);
             $this->_message->setHeader(array('Time', 'Event', 'Parameters'));
             $this->_message->setDestroy(true);
             Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message);
         }
     } else {
         if ($this->_message) {
             $this->_message->setDestroy(true);
             $this->_message = null;
         }
     }
     return $this;
 }
コード例 #12
0
 /**
  * Display profiling results and flush output buffer
  *
  * @param Stat $stat
  * @return void
  */
 public function display(Stat $stat)
 {
     $firebugMessage = new \Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_renderCaption());
     $firebugMessage->setHeader(array_keys($this->_columns));
     foreach ($this->_getTimerIds($stat) as $timerId) {
         $row = array();
         foreach ($this->_columns as $column) {
             $row[] = $this->_renderColumnValue($stat->fetch($timerId, $column), $column);
         }
         $firebugMessage->addRow($row);
     }
     \Zend_Wildfire_Plugin_FirePhp::send($firebugMessage);
     // setup the wildfire channel
     $firebugChannel = \Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $firebugChannel->setRequest($this->getRequest());
     $firebugChannel->setResponse($this->getResponse());
     // flush the wildfire headers into the response object
     $firebugChannel->flush();
     // send the response headers
     $firebugChannel->getResponse()->sendHeaders();
     ob_end_flush();
 }
コード例 #13
0
ファイル: Firebug.php プロジェクト: buttasg/cowgirlk
 /**
  * Display profiling results and flush output buffer
  */
 public function display()
 {
     $firebugMessage = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_renderCaption());
     $firebugMessage->setHeader(array_keys($this->_getColumns()));
     foreach ($this->_getTimers() as $timerId) {
         $row = array();
         foreach ($this->_getColumns() as $columnId) {
             $row[] = $this->_renderColumnValue($timerId, $columnId);
         }
         $firebugMessage->addRow($row);
     }
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($firebugMessage);
     // setup the wildfire channel
     $firebugChannel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $firebugChannel->setRequest($this->_request ? $this->_request : new Zend_Controller_Request_Http());
     $firebugChannel->setResponse($this->_response ? $this->_response : new Zend_Controller_Response_Http());
     // flush the wildfire headers into the response object
     $firebugChannel->flush();
     // send the response headers
     $firebugChannel->getResponse()->sendHeaders();
     ob_end_flush();
 }
コード例 #14
0
 public function _check($subject, $controller, $action)
 {
     $decisions = array();
     $object = Zend_Registry::get('userid');
     $user = new Evil_Object_Fixed('user', $object);
     $role = $user->getValue('role');
     $logger = Zend_Registry::get('logger');
     Zend_Wildfire_Plugin_FirePhp::group('Access');
     $conditions = array('controller', 'action', 'object', 'subject', 'role');
     foreach (self::$_rules as $ruleName => $rule) {
         $selected = true;
         foreach ($conditions as $condition) {
             if (isset($rule[$condition])) {
                 if (is_array($rule[$condition])) {
                     if (!in_array(${$condition}, $rule[$condition])) {
                         $selected = false;
                         break;
                     }
                 } elseif ($rule[$condition] != ${$condition}) {
                     $selected = false;
                     break;
                 }
             }
         }
         if ($selected) {
             $decisions[(int) $rule['weight']] = $rule['decision'];
             $logger->log($ruleName . ' applicable!', Zend_Log::INFO);
         }
     }
     if (count($decisions) > 0) {
         $decision = $decisions[max(array_keys($decisions))];
         $logger->info('Вердикт: ' . $decision);
     } else {
         throw new Exception('No rules applicable');
     }
     Zend_Wildfire_Plugin_FirePhp::groupEnd('Access');
     return $decision;
 }
コード例 #15
0
ファイル: UTF8.php プロジェクト: laiello/firephp
<?php

require_once dirname(__FILE__) . '/.Start.php';
Zend_Wildfire_Plugin_FirePhp::send(array("Отладочный"), 'UTF-8 characters with json_encode()', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send("Отладочный", 'UTF-8 characters with json_encode()', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send(array('Test work. Проверка работы.'), 'UTF-8 characters with json_encode()', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send('Test work. Проверка работы.', 'UTF-8 characters with json_encode()', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Json::$useBuiltinEncoderDecoder = true;
Zend_Wildfire_Plugin_FirePhp::send(array("Отладочный"), 'UTF-8 characters with Zend_Json_Encoder::encode()', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send("Отладочный", 'UTF-8 characters with Zend_Json_Encoder::encode()', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send(array('Test work. Проверка работы.'), 'UTF-8 characters with Zend_Json_Encoder::encode()', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send('Test work. Проверка работы.', 'UTF-8 characters with Zend_Json_Encoder::encode()', Zend_Wildfire_Plugin_FirePhp::LOG);
require_once dirname(__FILE__) . '/.End.php';
コード例 #16
0
ファイル: AdvancedLogging.php プロジェクト: laiello/firephp
require_once dirname(__FILE__) . '/.Start.php';
Zend_Wildfire_Plugin_FirePhp::send('Hello World');
/* Defaults to FirePHP::LOG */
Zend_Wildfire_Plugin_FirePhp::send('Log message', '', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send('Info message', '', Zend_Wildfire_Plugin_FirePhp::INFO);
Zend_Wildfire_Plugin_FirePhp::send('Warn message', '', Zend_Wildfire_Plugin_FirePhp::WARN);
Zend_Wildfire_Plugin_FirePhp::send('Error message', '', Zend_Wildfire_Plugin_FirePhp::ERROR);
Zend_Wildfire_Plugin_FirePhp::send('Message with label', 'Label', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send(true, 'Label', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send(false, 'Label', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send(null, 'Label', Zend_Wildfire_Plugin_FirePhp::INFO);
Zend_Wildfire_Plugin_FirePhp::send(1, 'Label', Zend_Wildfire_Plugin_FirePhp::WARN);
Zend_Wildfire_Plugin_FirePhp::send(1.1, 'Label', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send(array('key1' => 'val1', 'key2' => array(array('v1', 'v2'), 'v3')), 'TestArray', Zend_Wildfire_Plugin_FirePhp::LOG);
function test($Arg1)
{
    throw new Exception('Test Exception');
}
try {
    test(array('Hello' => 'World'));
} catch (Exception $e) {
    /* Log exception including stack trace & variables */
    Zend_Wildfire_Plugin_FirePhp::send($e);
}
Zend_Wildfire_Plugin_FirePhp::send('Backtrace to here', '', Zend_Wildfire_Plugin_FirePhp::TRACE);
Zend_Wildfire_Plugin_FirePhp::send(array('2 SQL queries took 0.06 seconds', array(array('SQL Statement', 'Time', 'Result'), array('SELECT * FROM Foo', '0.02', array('row1', 'row2')), array('SELECT * FROM Bar', '0.04', array('row1', 'row2')))), '', Zend_Wildfire_Plugin_FirePhp::TABLE);
Zend_Wildfire_Plugin_FirePhp::send(array(array('SQL Statement', 'Time', 'Result'), array('SELECT * FROM Foo', '0.02', array('row1', 'row2')), array('SELECT * FROM Bar', '0.04', array('row1', 'row2'))), '2 SQL queries took 0.06 seconds (Second Table)', Zend_Wildfire_Plugin_FirePhp::TABLE);
Zend_Wildfire_Plugin_FirePhp::send(array("Отладочный"), 'UTF-8 characters', Zend_Wildfire_Plugin_FirePhp::LOG);
/* Will show only in "Server" tab for the request */
Zend_Wildfire_Plugin_FirePhp::send(apache_request_headers(), 'RequestHeaders', Zend_Wildfire_Plugin_FirePhp::DUMP);
require_once dirname(__FILE__) . '/.End.php';
コード例 #17
0
ファイル: MySQLProfiling.php プロジェクト: Lazaro-Gallo/psmn
 /**
  * Constructs the FirePHP messages.
  *
  * @param array $profiles
  * @param string $label
  * @return Zend_Wildfire_Plugin_FirePhp_TableMessage
  */
 private function _constructFirePhp(array $columns, $label, $setBuffer = true)
 {
     $msg = new Zend_Wildfire_Plugin_FirePhp_TableMessage($label);
     // If a message is buffered it can be updated for the duration
     // of the request and is only flushed at the end of the request.
     $msg->setBuffered($setBuffer);
     $msg->setHeader($columns);
     // Destroy the message to prevent delivery
     $msg->setOption('includeLineNumbers', false);
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($msg);
     return $msg;
 }
コード例 #18
0
 /**
  * getGenerateTime
  *
  * @access  public
  * @param   strin $aComment
  * @param   bool $aPrint
  * @return  string time
  */
 public static function getGenerateTime($aComment = "")
 {
     if (!self::$enabled) {
         return;
     }
     $back = debug_backtrace();
     list($msec, $sec) = explode(chr(32), microtime());
     list($mTotal, $mSec) = self::getMemoryUsage();
     if (!isset(self::$time)) {
         self::$time["start"] = $sec + $msec;
         self::$time["section"] = $sec + $msec;
         self::$timer->addRow(array(sprintf("%01.4f", 0), sprintf("%01.4f", 0), $mSec, $mTotal, $aComment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
     } else {
         $start = self::$time["section"];
         self::$time["section"] = $sec + $msec;
         self::$timer->addRow(array(sprintf("%01.4f", round(self::$time["section"] - $start, 4)), sprintf("%01.4f", round(self::$time["section"] - self::$time["start"], 4)), $mSec, $mTotal, $aComment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
     }
     self::updateMessageLabel();
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send(self::$timer);
 }
コード例 #19
0
ファイル: Firebug.php プロジェクト: codercv/urbansurprisedev
 /**
  * Log a message to the Firebug Console.
  *
  * @param array $event The event data
  * @return void
  */
 protected function _write($event)
 {
     if (!$this->getEnabled()) {
         return;
     }
     if (array_key_exists($event['priority'], $this->_priorityStyles)) {
         $type = $this->_priorityStyles[$event['priority']];
     } else {
         $type = $this->_defaultPriorityStyle;
     }
     $message = $this->_formatter->format($event);
     $label = isset($event['firebugLabel']) ? $event['firebugLabel'] : null;
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($message, $label, $type, array('traceOffset' => 6));
 }
コード例 #20
0
ファイル: ObjectMembers.php プロジェクト: laiello/firephp
    static $publicStaticVar = 'Public static Var';
    protected $protectedVar = 'Protected Var';
    protected static $protectedStaticVar = 'Protected static Var';
    private $privateVar = 'PrivateVar';
    private static $privateStaticVar = 'Private static Var';
    public $publicVar2 = 'Public var 2';
    public static $publicStaticVar2 = 'Public static var 2';
    private $lotsOfData = "jhsdfjkhsdfjh sdkjhfasjkdhf sakjdhfg skaj dfhsa dfk jhsdfgkjsa dfksadf sadf sadfh\n jksdjhfg sadjkhfsahjdfghja sdfkj sajdfhkgsadfhj sfd jahksdfhjas dfjkahsdfhjasg dfkas df jhasdf ajkshdfgjhkadfs";
}
class TestObject2
{
    var $publicVar = 'Public Var';
    private $privateVar = 'PrivateVar';
}
class TestObject3
{
}
$obj = new TestObject();
$obj2 = new TestObject2();
$obj3 = new TestObject3();
$obj->child = $obj2;
$obj->child2 = $obj3;
$obj->child3 = $obj;
$obj = array('hello' => 'world', 'obj' => $obj, 'last' => 30, array('foo' => 'bar'), array('first', 'second'));
Zend_Wildfire_Plugin_FirePhp::send($obj, 'Test Object', Zend_Wildfire_Plugin_FirePhp::INFO);
$obj1 = new stdClass();
$obj2 = new stdClass();
$obj1->p = $obj2;
$obj2->p = $obj1;
Zend_Wildfire_Plugin_FirePhp::send($obj1, '$obj1', Zend_Wildfire_Plugin_FirePhp::INFO);
require_once dirname(__FILE__) . '/.End.php';
コード例 #21
0
ファイル: WildfireTest.php プロジェクト: lortnus/zf1
 public function testFirePhpPluginSubclass()
 {
     $firephp = Zend_Wildfire_Plugin_FirePhp::init('Zend_Wildfire_WildfireTest_FirePhpPlugin');
     $this->assertEquals(get_class($firephp), 'Zend_Wildfire_WildfireTest_FirePhpPlugin');
     Zend_Wildfire_Plugin_FirePhp::destroyInstance();
     try {
         Zend_Wildfire_Plugin_FirePhp::init('Zend_Wildfire_WildfireTest_Request');
         $this->fail('Should not be able to initialize');
     } catch (Exception $e) {
         // success
     }
     $this->assertNull(Zend_Wildfire_Plugin_FirePhp::getInstance(true));
     try {
         Zend_Wildfire_Plugin_FirePhp::init(array());
         $this->fail('Should not be able to initialize');
     } catch (Exception $e) {
         // success
     }
     $this->assertNull(Zend_Wildfire_Plugin_FirePhp::getInstance(true));
 }
コード例 #22
0
ファイル: FirebugTest.php プロジェクト: lortnus/zf1
 public function tearDown()
 {
     $this->_db->getConnection()->exec('DROP TABLE foo');
     Zend_Wildfire_Channel_HttpHeaders::destroyInstance();
     Zend_Wildfire_Plugin_FirePhp::destroyInstance();
 }
コード例 #23
0
ファイル: Groups.php プロジェクト: laiello/firephp
<?php

require_once dirname(__FILE__) . '/.Start.php';
Zend_Wildfire_Plugin_FirePhp::group('Group 1');
Zend_Wildfire_Plugin_FirePhp::send('Log message 1', '', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::group('Group 2');
Zend_Wildfire_Plugin_FirePhp::send('Log message 2', '', Zend_Wildfire_Plugin_FirePhp::INFO);
Zend_Wildfire_Plugin_FirePhp::send('Backtrace to here', '', Zend_Wildfire_Plugin_FirePhp::TRACE);
Zend_Wildfire_Plugin_FirePhp::groupEnd();
Zend_Wildfire_Plugin_FirePhp::send('Log message 3', 'Label', Zend_Wildfire_Plugin_FirePhp::WARN);
Zend_Wildfire_Plugin_FirePhp::groupEnd();
require_once dirname(__FILE__) . '/.End.php';
コード例 #24
0
 /**
  * @group ZF-10537
  */
 public function testFileLineOffsets()
 {
     $firephp = Zend_Wildfire_Plugin_FirePhp::getInstance();
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     $firephp->setOption('includeLineNumbers', true);
     $firephp->setOption('maxTraceDepth', 0);
     $lines = array();
     // NOTE: Do NOT separate the following pairs otherwise the line numbers will not match for the test
     // Message number: 1
     $lines[] = __LINE__ + 1;
     $this->_logger->log('Hello World', Zend_Log::INFO);
     // Message number: 2
     $this->_logger->addPriority('TRACE', 8);
     $this->_writer->setPriorityStyle(8, 'TRACE');
     $lines[] = __LINE__ + 1;
     $this->_logger->trace('Trace to here');
     // Message number: 3
     $this->_logger->addPriority('TABLE', 9);
     $this->_writer->setPriorityStyle(9, 'TABLE');
     $table = array('Summary line for the table', array(array('Column 1', 'Column 2'), array('Row 1 c 1', ' Row 1 c 2'), array('Row 2 c 1', ' Row 2 c 2')));
     $lines[] = __LINE__ + 1;
     $this->_logger->table($table);
     // Message number: 4
     $lines[] = __LINE__ + 1;
     $this->_logger->info('Hello World');
     $messages = $protocol->getMessages();
     $messages = $messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI];
     for ($i = 0; $i < sizeof($messages); $i++) {
         if (!preg_match_all('/FirebugTest\\.php","Line":' . $lines[$i] . '/', $messages[$i], $m)) {
             $this->fail("File and line does not match for message number: " . ($i + 1));
         }
     }
 }
コード例 #25
0
 /**
  * Log a message to the Firebug Console.
  *
  * @param array $event The event data
  * @return void
  */
 protected function _write($event)
 {
     if (!$this->getEnabled()) {
         return;
     }
     if (array_key_exists($event['priority'], $this->_priorityStyles)) {
         $type = $this->_priorityStyles[$event['priority']];
     } else {
         $type = $this->_defaultPriorityStyle;
     }
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($event['message'], null, $type);
 }
コード例 #26
0
ファイル: FirebugTest.php プロジェクト: rexmac/zf2
 /**
  * @group ZF-4934
  */
 public function testAdvancedLogging()
 {
     Zend_Wildfire_Plugin_FirePhp::getInstance()->setOption('maxTraceDepth', 0);
     $message = 'This is a log message!';
     $label = 'Test Label';
     $table = array('Summary line for the table', array(array('Column 1', 'Column 2'), array('Row 1 c 1', ' Row 1 c 2'), array('Row 2 c 1', ' Row 2 c 2')));
     $this->_logger->addPriority('TRACE', 8);
     $this->_logger->addPriority('TABLE', 9);
     $this->_writer->setPriorityStyle(8, 'TRACE');
     $this->_writer->setPriorityStyle(9, 'TABLE');
     $this->_logger->trace($message);
     $this->_logger->table($table);
     try {
         throw new Exception('Test Exception');
     } catch (Exception $e) {
         $this->_logger->err($e);
     }
     try {
         Zend_Wildfire_Plugin_FirePhp::send($message, $label, 'UNKNOWN');
         $this->fail('Should not be able to log with undefined log style');
     } catch (Exception $e) {
         // success
     }
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     $messages = array(Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE => array(Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI => array(1 => '[{"Type":"TABLE"},["Summary line for the table",[["Column 1","Column 2"],["Row 1 c 1"," Row 1 c 2"],["Row 2 c 1"," Row 2 c 2"]]]]')));
     $qued_messages = $protocol->getMessages();
     unset($qued_messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][0]);
     unset($qued_messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][2]);
     $this->assertEquals(serialize($qued_messages), serialize($messages));
 }
コード例 #27
0
ファイル: DeepVariables.php プロジェクト: laiello/firephp
function test($table)
{
    Zend_Wildfire_Plugin_FirePhp::send($table, 'Test deep table', Zend_Wildfire_Plugin_FirePhp::TABLE);
    throw new Exception('Test Exception');
}
コード例 #28
0
ファイル: LineNumbers.php プロジェクト: laiello/firephp
<?php

require_once dirname(__FILE__) . '/.Start.php';
$firephp = Zend_Wildfire_Plugin_FirePhp::getInstance();
Zend_Wildfire_Plugin_FirePhp::send('Hello World', 'Label', Zend_Wildfire_Plugin_FirePhp::LOG);
Zend_Wildfire_Plugin_FirePhp::send('', 'Trace to here', Zend_Wildfire_Plugin_FirePhp::TRACE);
try {
    test();
} catch (Exception $e) {
    Zend_Wildfire_Plugin_FirePhp::send($e);
}
function test()
{
    throw new Exception('Test Exception');
}
$logger = Zend_Registry::get('logger');
$logger->info('Test info message');
$logger->addPriority('TRACE', 8);
$writer->setPriorityStyle(8, 'TRACE');
$logger->trace('Trace to here');
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
$profiler->setEnabled(true);
$db = Zend_Db::factory('PDO_SQLITE', array('dbname' => ':memory:'));
$db->setProfiler($profiler);
$db->getConnection()->exec('CREATE TABLE foo (
                              id      INTEGNER NOT NULL,
                              col1    VARCHAR(10) NOT NULL  
                            )');
$db->insert('foo', array('id' => 1, 'col1' => 'original'));
require_once dirname(__FILE__) . '/.End.php';
コード例 #29
0
 /**
  * Destroys the singleton instance
  *
  * Primarily used for testing.
  *
  * @return void
  */
 public static function destroyInstance()
 {
     self::$_instance = null;
 }
コード例 #30
0
ファイル: FirePhp.php プロジェクト: ronseigel/agent-ohm
 /**
  * Logs variables to the Firebug Console
  * via HTTP response headers and the FirePHP Firefox Extension.
  *
  * @param  mixed  $var   The variable to log.
  * @param  string  $label OPTIONAL Label to prepend to the log event.
  * @param  string  $style  OPTIONAL Style of the log event.
  * @return boolean Returns TRUE if the variable was added to the response headers or buffered.
  * @throws Zend_Wildfire_Exception
  */
 public static function send($var, $label = null, $style = null)
 {
     if (self::$_instance === null) {
         self::getInstance();
     }
     if (!self::$_instance->_enabled) {
         return false;
     }
     if ($var instanceof Zend_Wildfire_Plugin_FirePhp_Message) {
         if ($var->getBuffered()) {
             if (!in_array($var, self::$_instance->_messages)) {
                 self::$_instance->_messages[] = $var;
             }
             return true;
         }
         if ($var->getDestroy()) {
             return false;
         }
         $style = $var->getStyle();
         $label = $var->getLabel();
         $var = $var->getMessage();
     }
     if (!self::$_instance->_channel->isReady()) {
         return false;
     }
     if ($var instanceof Exception) {
         $var = array('Class' => get_class($var), 'Message' => $var->getMessage(), 'File' => $var->getFile(), 'Line' => $var->getLine(), 'Type' => 'throw', 'Trace' => $var->getTrace());
         $style = self::EXCEPTION;
     } else {
         if ($style == self::TRACE) {
             $trace = debug_backtrace();
             if (!$trace) {
                 return false;
             }
             for ($i = 0; $i < sizeof($trace); $i++) {
                 if (isset($trace[$i]['class']) && substr($trace[$i]['class'], 0, 8) != 'Zend_Log' && substr($trace[$i]['class'], 0, 13) != 'Zend_Wildfire') {
                     $i--;
                     break;
                 }
             }
             if ($i == sizeof($trace)) {
                 $i = 0;
             }
             $var = array('Class' => $trace[$i]['class'], 'Type' => $trace[$i]['type'], 'Function' => $trace[$i]['function'], 'Message' => isset($trace[$i]['args'][0]) ? $trace[$i]['args'][0] : '', 'File' => isset($trace[$i]['file']) ? $trace[$i]['file'] : '', 'Line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : '', 'Args' => $trace[$i]['args'], 'Trace' => array_splice($trace, $i + 1));
         } else {
             if ($style === null) {
                 $style = self::LOG;
             }
         }
     }
     switch ($style) {
         case self::LOG:
         case self::INFO:
         case self::WARN:
         case self::ERROR:
         case self::EXCEPTION:
         case self::TRACE:
         case self::TABLE:
         case self::DUMP:
         case self::GROUP_START:
         case self::GROUP_END:
             break;
         default:
             #require_once 'Zend/Wildfire/Exception.php';
             throw new Zend_Wildfire_Exception('Log style "' . $style . '" not recognized!');
             break;
     }
     if ($style == self::DUMP) {
         return self::$_instance->_recordMessage(self::STRUCTURE_URI_DUMP, array('key' => $label, 'data' => $var));
     } else {
         $meta = array('Type' => $style);
         if ($label != null) {
             $meta['Label'] = $label;
         }
         return self::$_instance->_recordMessage(self::STRUCTURE_URI_FIREBUGCONSOLE, array('data' => $var, 'meta' => $meta));
     }
 }