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


PHP Debugger::formatTrace方法代码示例

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


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

示例1: _outputMessage

 protected function _outputMessage($template)
 {
     $error = $this->controller->viewVars['error'];
     $data = [];
     $data['class'] = 'Error';
     $data['code'] = $error->getCode();
     $data['url'] = '/' . $this->controller->request->url;
     $data['message'] = $error->getMessage();
     $data['errors'] = $this->controller->viewVars['errors'];
     if (Configure::read('debug')) {
         $data['DEBUG']['trace'] = Debugger::formatTrace($error->getTrace(), ['format' => 'array', 'args' => false]);
         $queryLog = $this->_getQueryLog();
         if ($queryLog) {
             $data['DEBUG']['queryLog'] = $queryLog;
         }
     }
     $jsonOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT;
     if (Configure::read('debug')) {
         $jsonOptions = $jsonOptions | JSON_PRETTY_PRINT;
     }
     $this->controller->response->type('json');
     $this->controller->response->body(json_encode($data, $jsonOptions));
     $this->controller->response->statusCode($data['code']);
     return $this->controller->response;
 }
开发者ID:pwerken,项目名称:va-void,代码行数:25,代码来源:ApiExceptionRenderer.php

示例2: _getErrorData

 /**
  * Helper method used to generate extra debugging data into the error template
  *
  * @return array debugging data
  */
 protected function _getErrorData()
 {
     $data = [];
     $viewVars = $this->controller->viewVars;
     if (!empty($viewVars['_serialize'])) {
         foreach ($viewVars['_serialize'] as $v) {
             $data[$v] = $viewVars[$v];
         }
     }
     if (!empty($viewVars['error']) && Configure::read('debug')) {
         $data['exception'] = ['class' => get_class($viewVars['error']), 'code' => $viewVars['error']->getCode(), 'message' => $viewVars['error']->getMessage()];
         if (!isset($data['trace'])) {
             $data['trace'] = Debugger::formatTrace($viewVars['error']->getTrace(), ['format' => 'array', 'args' => false]);
         }
     }
     return $data;
 }
开发者ID:friendsofcake,项目名称:crud,代码行数:22,代码来源:ExceptionRenderer.php

示例3: render

 /**
  * Renders the response for the exception.
  *
  * @return \Cake\Network\Response The response to be sent.
  */
 public function render()
 {
     $exception = $this->error;
     $code = $this->_code($exception);
     $method = $this->_method($exception);
     $template = $this->_template($exception, $method, $code);
     $unwrapped = $this->_unwrap($exception);
     $isDebug = Configure::read('debug');
     if (($isDebug || $exception instanceof HttpException) && method_exists($this, $method)) {
         return $this->_customMethod($method, $unwrapped);
     }
     $message = $this->_message($exception, $code);
     $url = $this->controller->request->here();
     if (method_exists($exception, 'responseHeader')) {
         $this->controller->response->header($exception->responseHeader());
     }
     $this->controller->response->statusCode($code);
     $viewVars = ['message' => $message, 'url' => h($url), 'error' => $unwrapped, 'code' => $code, '_serialize' => ['message', 'url', 'code']];
     if ($isDebug) {
         $viewVars['trace'] = Debugger::formatTrace($unwrapped->getTrace(), ['format' => 'array', 'args' => false]);
         $viewVars['_serialize'][] = 'trace';
     }
     $this->controller->set($viewVars);
     if ($unwrapped instanceof CakeException && $isDebug) {
         $this->controller->set($unwrapped->getAttributes());
     }
     return $this->_outputMessage($template);
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:33,代码来源:ExceptionRenderer.php

示例4: trace

 /**
  * Outputs a stack trace based on the supplied options.
  *
  * ### Options
  *
  * - `depth` - The number of stack frames to return. Defaults to 999
  * - `format` - The format you want the return. Defaults to the currently selected format. If
  *    format is 'array' or 'points' the return will be an array.
  * - `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 0
  *
  * @param array $options Format for outputting stack trace.
  * @return mixed Formatted stack trace.
  * @link http://book.cakephp.org/3.0/en/development/debugging.html#generating-stack-traces
  */
 public static function trace(array $options = [])
 {
     return Debugger::formatTrace(debug_backtrace(), $options);
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:20,代码来源:Debugger.php


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