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


PHP Debugger::trace方法代码示例

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


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

示例1: getHtml

 /**
  * get the body for htmll message
  *
  * @access private
  * @author sakuragawa
  */
 private 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>', self::dumper($trace), '</pre>', '', '<h2>', 'Request:', '</h2>', '', '<h3>URL</h3>', $this->url(), '<h3>Client IP</h3>', $this->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("", $msg);
 }
开发者ID:fusic,项目名称:encount,代码行数:14,代码来源:Mail.php

示例2: addCall

 /**
  * Add a HTTP call to the data
  *
  * @param Request  $request Call request
  * @param Response $response Call response
  * @param float    $time duration of the call
  */
 public static function addCall($request, $response, $time = null)
 {
     $calls = static::config('calls');
     $trace = Debugger::trace(['start' => 2]);
     $calls[] = ['request' => ['uri' => (string) $request->getUri(), 'body' => $request->body(), 'method' => $request->getMethod(), 'headers' => $request->getHeaders(), 'content-type' => $request->getHeader('Content-Type')], 'response' => ['body' => $response->body(), 'status_code' => $response->getStatusCode(), 'headers' => $response->getHeaders(), 'content-type' => $response->getHeader('Content-Type')], 'time' => $time, 'trace' => $trace];
     static::drop('calls');
     static::config('calls', $calls);
 }
开发者ID:dorxy,项目名称:debug_http,代码行数:15,代码来源:ClientCallPanel.php

示例3: addCall

 /**
  * Add a HTTP call to the data
  *
  * @param $request
  * @param $response
  * @param $time
  */
 public static function addCall($request, $response, $time = null)
 {
     $calls = static::config('calls');
     $trace = Debugger::trace(['start' => 2]);
     $calls[] = ['request' => $request, 'response' => $response, 'time' => $time, 'trace' => $trace];
     static::drop('calls');
     static::config('calls', $calls);
 }
开发者ID:Oxicode,项目名称:debug_http,代码行数:15,代码来源:ClientCallPanel.php

示例4: _exec

 /**
  * exec method
  *
  * @param mixed $cmd ''
  * @param mixed &$out null
  * @return bool True if successful
  */
 protected function _exec($cmd, &$out = null)
 {
     if (DS === '/') {
         $_out = exec($cmd . ' 2>&1', $out, $return);
     } else {
         $_out = exec($cmd, $out, $return);
     }
     if (Configure::read('debug')) {
         $source = Debugger::trace(array('depth' => 1, 'start' => 2)) . "\n";
         //Log::write('system_calls_' . date('Y-m-d'), "\n" . $source . Debugger::exportVar(compact('cmd','out','return')));
         //Log::write('system_calls', "\n" . $source . Debugger::exportVar(compact('cmd','out','return')));
     }
     if ($return) {
         return false;
     }
     return $_out ? $_out : true;
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:24,代码来源:TidyHelper.php

示例5: 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
  */
 function stackTrace(array $options = [])
 {
     if (!Configure::read('debug')) {
         return;
     }
     $options += ['start' => 0];
     $options['start']++;
     echo Debugger::trace($options);
 }
开发者ID:wepbunny,项目名称:cake2,代码行数:22,代码来源:basics.php

示例6: _logError

 /**
  * Log an error.
  *
  * @param string $level The level name of the log.
  * @param array $data Array of error data.
  * @return bool
  */
 protected function _logError($level, $data)
 {
     $message = sprintf('%s (%s): %s in [%s, line %s]', $data['error'], $data['code'], $data['description'], $data['file'], $data['line']);
     if (!empty($this->_options['trace'])) {
         $trace = Debugger::trace(['start' => 1, 'format' => 'log']);
         $message .= "\nTrace:\n" . $trace . "\n";
     }
     $message .= "\n\n";
     return Log::write($level, $message);
 }
开发者ID:thomasohta,项目名称:cakephp,代码行数:17,代码来源:BaseErrorHandler.php

示例7: testStackTrace

 /**
  * Tests that the stackTrace() method is a shortcut for Debugger::trace()
  *
  * @return void
  */
 public function testStackTrace()
 {
     ob_start();
     list($r, $expected) = [stackTrace(), \Cake\Error\Debugger::trace()];
     $result = ob_get_clean();
     $this->assertEquals($expected, $result);
     $opts = ['args' => true];
     ob_start();
     list($r, $expected) = [stackTrace($opts), \Cake\Error\Debugger::trace($opts)];
     $result = ob_get_clean();
     $this->assertEquals($expected, $result);
 }
开发者ID:neilan35,项目名称:betterwindow1,代码行数:17,代码来源:BasicsTest.php

示例8: testTraceExclude

 /**
  * test trace exclude
  *
  * @return void
  */
 public function testTraceExclude()
 {
     $result = Debugger::trace();
     $this->assertRegExp('/^Cake\\\\Test\\\\TestCase\\\\Error\\\\DebuggerTest::testTraceExclude/', $result);
     $result = Debugger::trace(['exclude' => ['Cake\\Test\\TestCase\\Error\\DebuggerTest::testTraceExclude']]);
     $this->assertNotRegExp('/^Cake\\\\Test\\\\TestCase\\\\Error\\\\DebuggerTest::testTraceExclude/', $result);
 }
开发者ID:alexunique0519,项目名称:Blog_Cakephp_association,代码行数:12,代码来源:DebuggerTest.php

示例9: 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
     */
    public static 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">

<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 = htmlspecialchars($var);
                if ($showFrom) {
                    $lineInfo = sprintf('<span><strong>%s</strong> (line <strong>%s</strong>)</span>', $file, $line);
                }
            }
            printf($template, $var);
        }
    }
开发者ID:OrigamiStructures,项目名称:foldingTime,代码行数:59,代码来源:dmDebug.php

示例10: debug

    /**
     * Prints out debug information about given variable.
     *
     * Only runs if debug level is greater than zero.
     *
     * @param mixed $var Variable to show debug information for.
     * @param bool|null $showHtml If set to true, the method prints the debug data in a browser-friendly way.
     * @param bool $showFrom If set to true, the method prints from where the function was called.
     * @return void
     * @link http://book.cakephp.org/3.0/en/development/debugging.html#basic-debugging
     * @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#debug
     */
    public static function debug($var, $showHtml = null, $showFrom = true)
    {
        if (!Configure::read('debug')) {
            return;
        }
        $file = '';
        $line = '';
        $lineInfo = '';
        if ($showFrom) {
            $trace = Debugger::trace(['start' => 1, 'depth' => 2, 'format' => 'array']);
            $search = [ROOT];
            if (defined('CAKE_CORE_INCLUDE_PATH')) {
                array_unshift($search, CAKE_CORE_INCLUDE_PATH);
            }
            $file = str_replace($search, '', $trace[0]['file']);
            $line = $trace[0]['line'];
        }
        $html = <<<HTML
<pre class="cake-debug">
%s
</pre>
</div>
HTML;
        $text = <<<TEXT
%s
########## DEBUG ##########
%s
###########################

TEXT;
        $template = $html;
        if (PHP_SAPI === '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, $var);
    }
开发者ID:OrigamiStructures,项目名称:OSDebug,代码行数:62,代码来源:OSDebug.php


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