当前位置: 首页>>代码示例>>PHP>>正文


PHP Debugger::trace方法代码示例

本文整理汇总了PHP中Debugger::trace方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::trace方法的具体用法?PHP Debugger::trace怎么用?PHP Debugger::trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Debugger的用法示例。


在下文中一共展示了Debugger::trace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($message = null, $code = 0, Exception $previous = null)
 {
     if (Configure::read('ModularAuth.debug_trace')) {
         $trace = "\n" . Debugger::trace(array('start' => 1));
         var_dump($trace);
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:hiromi2424,项目名称:modular_auth,代码行数:8,代码来源:modular_auth_exception.php

示例2: getHtml

 public static function getHtml($message, $file, $line, $context = null)
 {
     $params = Router::getRequest();
     $trace = Debugger::trace(array('start' => 2, 'format' => 'base'));
     $session = isset($_SESSION) ? $_SESSION : array();
     $msg = array('<p><strong>', $message, '</strong></p>', '<p>', $file . '(' . $line . ')', '</p>', '', '<h2>', 'Backtrace:', '</h2>', '', '<pre>', trim($trace), '</pre>', '', '<h2>', 'Request:', '</h2>', '', '<h3>URL</h3>', self::getUrl(), '<h3>Client IP</h3>', self::getClientIp(), '<h3>Referer</h3>', env('HTTP_REFERER'), '<h3>Parameters</h3>', self::dumper($params), '<h3>Cake root</h3>', APP, '', '<h2>', 'Environment:', '</h2>', '', self::dumper($_SERVER), '', '<h2>', 'Session:', '</h2>', '', self::dumper($session), '', '<h2>', 'Cookie:', '</h2>', '', self::dumper($_COOKIE), '', '<h2>', 'Context:', '</h2>', '', self::dumper($context), '');
     return join("\n", $msg);
 }
开发者ID:k1low,项目名称:exception,代码行数:8,代码来源:ExceptionText.php

示例3: debug

 /**
  * debug method
  *
  * Dump the classes variables
  *
  * @return void
  * @access public
  */
 static function debug()
 {
     //@ignore
     debug(Debugger::trace());
     //@ignore
     debug(Notify::$method);
     //@ignore
     debug(Notify::$statuses);
     //@ignore
     debug(Notify::$notifiers);
     //@ignore
 }
开发者ID:rodrigorm,项目名称:cake_autotest,代码行数:20,代码来源:notify.php

示例4: debug

    /**
     * Prints out debug information about given variable.
     *
     * Only runs if debug level is greater than zero.
     *
     * @param boolean $var Variable to show debug information for.
     * @param boolean $showHtml If set to true, the method prints the debug data in a browser-friendly way.
     * @param boolean $showFrom If set to true, the method prints from where the function was called.
     * @return void
     * @link http://book.cakephp.org/2.0/en/development/debugging.html#basic-debugging
     * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#debug
     */
    function debug($var, $showHtml = null, $showFrom = true)
    {
        if (Configure::read('debug') > 0) {
            App::uses('Debugger', 'Utility');
            $file = '';
            $line = '';
            $lineInfo = '';
            if ($showFrom) {
                $trace = Debugger::trace(array('start' => 1, 'depth' => 2, 'format' => 'array'));
                $file = str_replace(array(CAKE_CORE_INCLUDE_PATH, ROOT), '', $trace[0]['file']);
                $line = $trace[0]['line'];
            }
            $html = <<<HTML

<div class="cake-debug-output">
%s
<pre class="cake-debug">
%s
</pre>
</div>
HTML;
            $text = <<<TEXT

%s
########## DEBUG ##########
%s
###########################

TEXT;
            $template = $html;
            if (php_sapi_name() === 'cli' || $showHtml === false) {
                $template = $text;
                if ($showFrom) {
                    $lineInfo = sprintf('%s (line %s)', $file, $line);
                }
            }
            if ($showHtml === null && $template !== $text) {
                $showHtml = true;
            }
            $var = Debugger::exportVar($var, 25);
            if ($showHtml) {
                $template = $html;
                $var = h($var);
                if ($showFrom) {
                    $lineInfo = sprintf('<span><strong>%s</strong> (line <strong>%s</strong>)</span>', $file, $line);
                }
            }
            printf($template, $lineInfo, $var);
        }
    }
开发者ID:pushpendraraj,项目名称:tigzie,代码行数:62,代码来源:basics.php

示例5: handleError

 /**
  * override core one with the following enhancements/fixes:
  * - 404s log to a different domain
  * - IP, Referer and Browser-Infos are added for better error debugging/tracing
  * 2011-12-21 ms
  */
 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     if (error_reporting() === 0) {
         return false;
     }
     $errorConfig = Configure::read('Error');
     list($error, $log) = self::mapErrorCode($code);
     $debug = Configure::read('debug');
     if ($debug) {
         $data = array('level' => $log, 'code' => $code, 'error' => $error, 'description' => $description, 'file' => $file, 'line' => $line, 'context' => $context, 'start' => 2, 'path' => Debugger::trimPath($file));
         return Debugger::getInstance()->outputError($data);
     } else {
         $message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
         if (!empty($errorConfig['trace'])) {
             $trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
             $message .= "\nTrace:\n" . $trace . "\n";
             $message .= self::traceDetails();
         }
         return CakeLog::write($log, $message);
     }
 }
开发者ID:robksawyer,项目名称:grabitdown,代码行数:27,代码来源:MyErrorHandler.php

示例6: element

 /**
  * Undo Mi logic when reporting an error for a missing view file
  *
  * @param mixed $name
  * @param array $params array()
  * @param bool $loadHelpers false
  * @return void
  * @access public
  */
 public function element($name, $params = array(), $loadHelpers = false)
 {
     $return = parent::element($name, $params, $loadHelpers);
     if (strpos($return, 'Not Found:') === 0) {
         $plugin = null;
         if (isset($params['plugin'])) {
             $plugin = $params['plugin'];
         }
         if (isset($this->plugin) && !$plugin) {
             $plugin = $this->plugin;
         }
         $paths = $this->_paths($plugin);
         $path = array_pop($paths);
         while ($paths && strpos($path, DS . 'locale' . DS)) {
             $path = array_pop($paths);
         }
         $file = $path . 'elements' . DS . $name . $this->ext;
         $trace = Debugger::trace();
         return "Not Found: " . $file . $trace;
     }
     return $return;
 }
开发者ID:razzman,项目名称:mi,代码行数:31,代码来源:Mi.php

示例7: handleError

 /**
  * HandleError
  *
  * @param integer $code Code of error
  * @param string $description Error description
  * @param string $file File on which error occurred
  * @param integer $line Line that triggered the error
  * @param array $context Context
  * @return boolean true if error was handled
  */
 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     extract(self::handlerSettings());
     $args = compact('code', 'description', 'file', 'line', 'context', 'session');
     if ($emailNotifications === true && !empty($receiver)) {
         $cacheHash = 'error-' . md5(serialize(compact($args)));
         self::setCacheConfig($duration);
         if (Cache::read($cacheHash, 'error_handler') === false || $caching === false) {
             list($error, $log) = self::mapErrorCode($code);
             if (in_array($log, $logLevels) || in_array($code, $codes)) {
                 $trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
                 $session = CakeSession::read();
                 $server = $_SERVER;
                 $request = $_REQUEST;
                 $Email = self::getEmailInstance();
                 $Email->viewVars(compact('code', 'description', 'file', 'line', 'context', 'session', 'server', 'request', 'trace'));
                 $Email->send();
             }
             Cache::write($cacheHash, true, 'error_handler');
         }
     }
     return parent::handleError($code, $description, $file, $line, $context);
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:33,代码来源:EmailErrorHandler.php

示例8: __dispatch

 function __dispatch($name)
 {
     $debug = Configure::read('debug') > 0;
     if ($debug) {
         var_dump(Debugger::trace());
         $this->controller->layout = 'cakephp';
     }
     if (empty($this->controller->viewVars['name'])) {
         $this->controller->set('name', __('Not Found', true));
         $this->controller->set('message', $debug ? h(Router::normalize($this->controller->here)) : '');
     }
     switch ($name) {
         case 'error500':
         case 'forbidden':
             return $name;
         default:
             if (Configure::read() === 0) {
                 return 'error404';
             } else {
                 return $name;
             }
     }
 }
开发者ID:hiromi2424,项目名称:cake_app_base,代码行数:23,代码来源:app_error.php

示例9: __construct

 /**
  * Class constructor.
  *
  * @param string $method Method producing the error
  * @param array $messages Error messages
  */
 function __construct($method, $messages)
 {
     App::import('Core', 'Sanitize');
     static $__previousError = null;
     if ($__previousError != array($method, $messages)) {
         $__previousError = array($method, $messages);
         $this->controller =& new CakeErrorController();
     } else {
         $this->controller =& new Controller();
         $this->controller->viewPath = 'errors';
     }
     $options = array('escape' => false);
     $messages = Sanitize::clean($messages, $options);
     if (!isset($messages[0])) {
         $messages = array($messages);
     }
     if (method_exists($this->controller, 'apperror')) {
         return $this->controller->appError($method, $messages);
     }
     if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($this)))) {
         $method = 'error';
     }
     if (!in_array($method, array('error'))) {
         if (Configure::read() == 0) {
             $method = 'error404';
             if (isset($code) && $code == 500) {
                 $method = 'error500';
             }
         }
     }
     if (defined('CAKE_TEST_OUTPUT_HTML')) {
         $this->controller->layout = 'ajax';
         debug(Debugger::trace());
     }
     $this->dispatchMethod($method, $messages);
     $this->_stop();
 }
开发者ID:Galvanio,项目名称:Kinspir,代码行数:43,代码来源:app_error.php

示例10: exec

 /**
  * Utility Exec method
  *
  * @param mixed $cmd
  * @param mixed $output
  * @return void
  * @access public
  */
 public function exec($cmd, &$out = array())
 {
     if (DS === '/') {
         $_out = exec($cmd . ' 2>&1', $out, $return);
     } else {
         $_out = exec($cmd, $out, $return);
     }
     if (Configure::read()) {
         $source = Debugger::trace(array('depth' => 1, 'start' => 2)) . "\n";
         CakeLog::write('system_calls_' . date('Y-m-d'), "\n" . $source . Debugger::exportVar(compact('cmd', 'out', 'return')));
         CakeLog::write('system_calls', "\n" . $source . Debugger::exportVar(compact('cmd', 'out', 'return')));
     }
     if ($return) {
         return false;
     }
     return $_out ? $_out : true;
 }
开发者ID:razzman,项目名称:mi,代码行数:25,代码来源:Mi.php

示例11: _getErrorMessage

 /**
  * Generate the string to use to describe the error.
  *
  * @param string $error The error type (e.g. "Warning")
  * @param int $code Code of error
  * @param string $description Error description
  * @param string $file File on which error occurred
  * @param int $line Line that triggered the error
  * @return string
  */
 protected static function _getErrorMessage($error, $code, $description, $file, $line)
 {
     $errorConfig = Configure::read('Error');
     $message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
     if (!empty($errorConfig['trace'])) {
         // https://bugs.php.net/bug.php?id=65322
         if (version_compare(PHP_VERSION, '5.4.21', '<')) {
             if (!class_exists('Debugger')) {
                 App::load('Debugger');
             }
             if (!class_exists('CakeText')) {
                 App::uses('CakeText', 'Utility');
                 App::load('CakeText');
             }
         }
         $trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
         $message .= "\nTrace:\n" . $trace . "\n";
     }
     return $message;
 }
开发者ID:hodrigohamalho,项目名称:cakephp-ex,代码行数:30,代码来源:ErrorHandler.php

示例12: isAuthorized

 /**
  * isAuthorized method
  *
  * Called only for the emails controller view action - restricts viewing an email on the web to 'normal' emails and
  * only for admin, the author or the recipient. The model id is set in the emails controller beforeFilter.
  *
  * @param mixed $user
  * @param mixed $controller
  * @param mixed $action
  * @return bool
  * @access public
  */
 public function isAuthorized($user, $controller, $action)
 {
     if ($controller != 'MiEmail' || $action != 'read') {
         debug('Email model isAuthorized has been called');
         //@ignore
         debug(Debugger::trace());
         //@ignore
         return false;
     }
     if (strtolower($user['User']['group']) == 'admin') {
         return true;
     } elseif (!$this->id) {
         return false;
     }
     $data = $this->read(array('from_user_id', 'to_user_id', 'type'));
     $validUsers = array($data[$this->alias]['to_user_id'], $data[$this->alias]['from_user_id']);
     if ($data[$this->alias]['type'] == 'normal' && in_array($user['User']['id'], $validUsers)) {
         return true;
     }
     return false;
 }
开发者ID:Wargo,项目名称:10rentacar,代码行数:33,代码来源:mi_email.php

示例13: testInstantiation

 /**
  * testInstantiation method
  *
  * @access public
  * @return void
  */
 function testInstantiation()
 {
     $this->skipUnless(strpos(Debugger::trace(), 'GroupTest') === false, '%s Cannot be run from within a group test');
     $Instance = Inflector::getInstance();
     $this->assertEqual(new Inflector(), $Instance);
 }
开发者ID:adaptivertc,项目名称:mosat,代码行数:12,代码来源:inflector.test.php

示例14: testChangeOutputFormats

 /**
  * Tests that changes in output formats using Debugger::output() change the templates used.
  *
  * @return void
  */
 function testChangeOutputFormats()
 {
     Debugger::invoke(Debugger::getInstance());
     Debugger::output('js', array('traceLine' => '{:reference} - <a href="txmt://open?url=file://{:file}' . '&line={:line}">{:path}</a>, line {:line}'));
     $result = Debugger::trace();
     $this->assertPattern('/' . preg_quote('txmt://open?url=file:///', '/') . '/', $result);
     Debugger::output('xml', array('error' => '<error><code>{:code}</code><file>{:file}</file><line>{:line}</line>' . '{:description}</error>', 'context' => "<context>{:context}</context>", 'trace' => "<stack>{:trace}</stack>"));
     Debugger::output('xml');
     ob_start();
     $foo .= '';
     $result = ob_get_clean();
     set_error_handler('SimpleTestErrorHandler');
     $data = array('error' => array(), 'code' => array(), '8', '/code', 'file' => array(), 'preg:/[^<]+/', '/file', 'line' => array(), '' . (intval(__LINE__) + -8), '/line', 'preg:/Undefined variable:\\s+foo/', '/error');
     $this->assertTags($result, $data, true);
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:20,代码来源:debugger.test.php

示例15: stackTrace

 /**
  * Outputs a stack trace based on the supplied options.
  *
  * ### Options
  *
  * - `depth` - The number of stack frames to return. Defaults to 999
  * - `args` - Should arguments for functions be shown? If true, the arguments for each method call
  *   will be displayed.
  * - `start` - The stack frame to start generating a trace from. Defaults to 1
  *
  * @param array $options Format for outputting stack trace
  *
  * @return mixed Formatted stack trace
  * @see Debugger::trace()
  */
 function stackTrace(array $options = array())
 {
     if (!Configure::read('debug')) {
         return;
     }
     App::uses('Debugger', 'Utility');
     $options += array('start' => 0);
     $options['start']++;
     echo Debugger::trace($options);
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:25,代码来源:basics.php


注:本文中的Debugger::trace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。