public function initFirePHP() { // 开启FirePHP调试或者关闭 $options = array('maxObjectDepth' => 10, 'maxArrayDepth' => 10, 'maxDepth' => 10, 'useNativeJsonEncode' => true, 'includeLineNumbers' => true); \FirePHP::getInstance(true)->setEnabled(true); \FB::setOptions($options); }
/** * The possible options are: * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL * - max_depth (int): maximum depth to traverse objects and arrays (Default 10). * - show_line (bool): include File and Line information in message (Default true). * * @param array $options */ public function __construct($options = null) { parent::__construct($options); $this->_max_depth = isset($options['max_depth']) ? filter_var($options['max_depth'], FILTER_VALIDATE_INT, array('options' => array('default' => 10, 'min_range' => 0))) : 10; $this->_show_line = isset($options['show_line']) ? filter_var($options['show_line'], FILTER_VALIDATE_BOOLEAN, array('options' => array('default' => true))) : true; $FBoptions = array('maxObjectDepth' => $this->_max_depth, 'maxArrayDepth' => $this->_max_depth, 'maxDepth' => $this->_max_depth, 'useNativeJsonEncode' => true, 'includeLineNumbers' => $this->_show_line); FB::setEnabled(true); FB::setOptions($FBoptions); $this->msg('Debug Console started at ' . date('c', time()) . ' from ' . gethostbyaddr($_SERVER['REMOTE_ADDR']), DEBUG_INFO); }
public function __construct($opts=array()) { if(empty($opts)){ $opts = array( 'maxObjectDepth' => 5, 'maxArrayDepth' => 5, 'maxDepth' => 10, 'useNativeJsonEncode' => true, 'includeLineNumbers' => true); } $this->opts = $opts; \FB::setOptions($opts); }
/** * * {@inheritDoc} * * @see \Psr\Log\LoggerInterface::log() */ public function log($level, $message, array $context = array()) { foreach ($context as $property => $val) { if (property_exists($this, $property)) { $this->{$property} = $val; } } $fb = new \FB(); if (!empty($this->options)) { $fb->setOptions($this->options); } $fb->send($message, $this->label, $level); if ($level == LogLevel::DEBUG) { foreach ($context as $label => $object) { $fb->send($object, $label, $level); } } }
/** * onAfterInitialise handler * * Register FirePHP libraries and set options according to paramters * * @access public * @return null */ public function onAfterInitialise() { require_once 'jfirephp' . DS . 'firephpcore' . DS . 'fb.php'; // JFirePHP is installed and loaed define('JFIREPHP', 1); // Before doing any checks lets disable logging FB::setEnabled(false); // Check if the integration is set to enabled $enable = (bool) $this->params->get('enable', 0); // Only turn on if enabled if ($enable) { // if limited to debug mode, check JDEBUG $limittodebug = (bool) $this->params->get('limittodebug', 1); if ($limittodebug == false || JDEBUG) { // We are enabled and either in Debug mode, or it does not matter FB::setEnabled(true); $verbose = (bool) $this->params->get('verbose', 0); if ($verbose) { FB::group('JFirePHP Startup', array('Collapsed' => true, 'Color' => '#FF4000')); FB::log('JFirePHP enabled! - Verbose Output Mode: ON'); } $options = array('maxObjectDepth' => intval($this->params->get('maxObjectDepth', 10)), 'maxArrayDepth' => intval($this->params->get('maxArrayDepth', 20)), 'useNativeJsonEncode' => intval($this->params->get('useNativeJsonEncode', 1)), 'includeLineNumbers' => intval($this->params->get('includeLineNumbers', 1))); FB::setOptions($options); if ($verbose) { FB::log('JFirePHP: Options Set - maxObjectDepth:' . $options['maxObjectDepth'] . ' maxArrayDepth:' . $options['maxArrayDepth'] . ' useNativeJsonEncode:' . $options['useNativeJsonEncode'] . ' includeLineNumbers:' . $options['includeLineNumbers']); } $redirectphp = (bool) $this->params->get('redirectphp', 0); if ($redirectphp) { // Convert E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE and // E_RECOVERABLE_ERROR errors to ErrorExceptions and send all Exceptions to Firebug automatically FB::registerErrorHandler(true); FB::registerExceptionHandler(); FB::registerAssertionHandler(true, false); if ($verbose) { FB::log('JFirePHP: E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE and E_RECOVERABLE_ERROR redirected.'); } } if ($verbose) { FB::groupEnd(); } } } }
<?php $firephp = FirePHP::getInstance(true); $firephp->setOptions(array('maxObjectDepth' => 2)); FB::setOptions(array('maxArrayDepth' => 3)); class TestObject { var $name = 'test data'; } class TestObject2 { var $name1 = 'name 1'; var $name2 = 'name 2'; var $name3 = 'name 3'; } $obj = new TestObject(); $obj->child = new TestObject(); $obj->child->child = new TestObject(); $obj->child->child->child = new TestObject(); $obj->child->child->child->child = new TestObject(); $obj->child2 = new TestObject2(); $obj->child2->name4 = 'name 4'; $firephp->setObjectFilter('TestObject2', array('name2', 'name4')); $firephp->fb($obj); $array = array(); $array['name'] = 'test data'; $array['child']['name'] = 'test data'; $array['child']['obj'] = $obj; $array['child']['child']['name'] = 'test data'; $array['child']['child']['child']['name'] = 'test data'; $obj->childArray = $array;
// nastavit DbControl config file cestu DbCfg::$cfgFilepath = LBoxLoaderConfig::getInstance()->getPathOf("db"); // pokud nemame pearovsky firePHP pouzivame lokani LBOXovy @(include "FirePHPCore/fb.php"); if (!class_exists("FirePHP")) { require LBOX_PATH_CORE . $slash . "firephp" . $slash . "0.3.1" . $slash . "lib" . $slash . "FirePHPCore" . $slash . "fb.php"; } // disable firePHP on remote mashines (enabled on localhost only!!!) if (LBOX_REQUEST_IP != LBOX_REQUEST_IP_MY) { FirePHP::getInstance(true)->setEnabled(false); FB::setEnabled(false); } $firePHPOptions = array('maxObjectDepth' => 10, 'maxArrayDepth' => 20, 'useNativeJsonEncode' => true, 'includeLineNumbers' => true); FirePHP::getInstance(true)->getOptions(); FirePHP::getInstance(true)->setOptions($firePHPOptions); FB::setOptions($firePHPOptions); // log exclude of: /*FirePHP::getInstance(true)->setObjectFilter('ClassName', array('MemberName'));*/ // TAL load // pokud nemame pearovsky PHPTAL pouzivame lokani LBOXovy @(include "PHPTAL.php"); if (!@constant("PHPTAL_VERSION")) { define("LBOX_PATH_PHPTAL", LBOX_PATH_CORE . $slash . "TAL" . $slash . "PHPTAL-1.2.1"); define("LBOX_PATH_PHPTAL_GETTEXTTRANSLATOR", LBOX_PATH_PHPTAL . $slash . "PHPTAL"); require LBOX_PATH_PHPTAL . $slash . "PHPTAL.php"; } else { define("LBOX_PATH_PHPTAL", "PHPTAL"); define("LBOX_PATH_PHPTAL_GETTEXTTRANSLATOR", LBOX_PATH_PHPTAL); } // TAL translator service to extend the standard
/** * Retrieve an instance of FirePHP * * @param array $options optional global options. * @return FirePHP */ public static function getFirePHP($options = null) { if (!isset(self::$_FirePHP) || !empty($options)) { if (!class_exists('\\FirePHP')) { throw new THEDEBUGException("FirePHP not available"); } /* Start output buffer so we can debug after headers would be sent regular */ if (!isset(self::$_FirePHP)) { ob_start(); } if (!empty($options)) { \FB::setOptions($options); } self::$_FirePHP = \FirePHP::getInstance(true); } return self::$_FirePHP; }
private static function setUpLogging() { $errorLogLocation = ini_get('error_log'); if (!isset($errorLogLocation) || $errorLogLocation == false) { ini_set('error_log', '/dev/stdout'); } $inDevMode = self::get('debug'); //$inDevMode = true; Log4PHP::init($inDevMode ? Log4PHP::DEBUG : Log4PHP::ERROR); if (self::get('FireBug') && $inDevMode) { FB::setOptions(['useNativeJsonEncode' => false]); ob_start(); Log4PHP::setOutput(Log4PHP::FIREBUG); } else { if (Cfg::get('quercus', false)) { Log4PHP::setOutput(Log4PHP::FILE); } else { Log4PHP::setOutput(Log4PHP::FILE); } } //Log4PHP::setOutput ( Log4PHP::SCREEN ); self::$log = Log4PHP::logFactory(__CLASS__); }