Exemple #1
0
 /**
  * class constructor will include the external console class, initialize it and store
  * its instance as $console property. the class can not be instantiated other
  * then using singleton method create. the loaded console class will be init and map
  * with its log types to this classed log types.
  *
  * @error 10901
  * @param string $driver expects the driver string to load
  * @param array $options expects an driver dependent option array
  * @throws Xapp_Error
  */
 protected function __construct($driver, array $options = array())
 {
     $this->_driver = strtolower(trim($driver));
     switch ($this->_driver) {
         case 'firephp':
             xapp_import('firephp.firephp-core.*');
             if (sizeof(ob_list_handlers()) === 0) {
                 ob_start();
             }
             $this->console = FirePHP::init();
             $this->console->setOptions($options);
             self::$_typeMap = array_merge(self::$_typeMap, array('log' => FirePHP::LOG, 'warn' => FirePHP::WARN, 'info' => FirePHP::INFO, 'error' => FirePHP::ERROR, 'dump' => FirePHP::DUMP, 'trace' => FirePHP::TRACE, 'group' => FirePHP::GROUP_START, 'ungroup' => FirePHP::GROUP_END));
             break;
         case 'chromephp':
             xapp_import('xapp.Ext.ChromePhp');
             $this->console = ChromePhp::getInstance();
             if (!isset($options[ChromePhp::BACKTRACE_LEVEL])) {
                 $options[ChromePhp::BACKTRACE_LEVEL] = 2;
             }
             $this->console->addSettings($options);
             self::$_typeMap = array_merge(self::$_typeMap, array('log' => ChromePhp::LOG, 'warn' => ChromePhp::WARN, 'info' => ChromePhp::INFO, 'error' => ChromePhp::ERROR, 'dump' => ChromePhp::INFO, 'trace' => ChromePhp::INFO, 'group' => ChromePhp::GROUP, 'ungroup' => ChromePhp::GROUP_END));
             break;
         default:
             throw new Xapp_Error(xapp_sprintf(_("xapp console driver: %s not supported"), $driver), 1090101);
     }
 }