mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进Trave调试输出 socket方式支持所有的请求
This commit is contained in:
@@ -201,12 +201,8 @@ class Debug
|
|||||||
|
|
||||||
if ($response instanceof Redirect) {
|
if ($response instanceof Redirect) {
|
||||||
//TODO 记录
|
//TODO 记录
|
||||||
} elseif (strpos($accept, 'application/json') === 0 || $request->isAjax()) {
|
|
||||||
//TODO 记录
|
|
||||||
} elseif (!empty($contentType) && strpos($contentType, 'html') === false) {
|
|
||||||
//TODO 记录
|
|
||||||
} else {
|
} else {
|
||||||
$output = $trace->output(Log::getLog());
|
$output = $trace->output($response, Log::getLog());
|
||||||
if (is_string($output)) {
|
if (is_string($output)) {
|
||||||
// trace调试信息注入
|
// trace调试信息注入
|
||||||
$content = $response->getContent();
|
$content = $response->getContent();
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ use think\Cache;
|
|||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Debug;
|
use think\Debug;
|
||||||
|
use think\Request;
|
||||||
|
use think\Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 浏览器调试输出
|
* 浏览器调试输出
|
||||||
@@ -36,11 +38,20 @@ class Console
|
|||||||
/**
|
/**
|
||||||
* 调试输出接口
|
* 调试输出接口
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $log 日志信息
|
* @param Response $response Response对象
|
||||||
|
* @param array $log 日志信息
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function output(array $log = [])
|
public function output(Response $response, array $log = [])
|
||||||
{
|
{
|
||||||
|
$request = Request::instance();
|
||||||
|
$contentType = $response->getHeader('Content-Type');
|
||||||
|
$accept = $request->header('accept');
|
||||||
|
if (strpos($accept, 'application/json') === 0 || $request->isAjax()) {
|
||||||
|
return false;
|
||||||
|
} elseif (!empty($contentType) && strpos($contentType, 'html') === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// 获取基本信息
|
// 获取基本信息
|
||||||
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
||||||
$reqs = number_format(1 / $runtime, 2);
|
$reqs = number_format(1 / $runtime, 2);
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ use think\Cache;
|
|||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Debug;
|
use think\Debug;
|
||||||
|
use think\Request;
|
||||||
|
use think\Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面Trace调试
|
* 页面Trace调试
|
||||||
@@ -36,12 +38,20 @@ class Html
|
|||||||
/**
|
/**
|
||||||
* 调试输出接口
|
* 调试输出接口
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $log 日志信息
|
* @param Response $response Response对象
|
||||||
|
* @param array $log 日志信息
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function output(array $log = [])
|
public function output(Response $response, array $log = [])
|
||||||
{
|
{
|
||||||
|
$request = Request::instance();
|
||||||
|
$contentType = $response->getHeader('Content-Type');
|
||||||
|
$accept = $request->header('accept');
|
||||||
|
if (strpos($accept, 'application/json') === 0 || $request->isAjax()) {
|
||||||
|
return false;
|
||||||
|
} elseif (!empty($contentType) && strpos($contentType, 'html') === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// 获取基本信息
|
// 获取基本信息
|
||||||
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
$runtime = number_format(microtime(true), 8, '.', '') - THINK_START_TIME;
|
||||||
$reqs = number_format(1 / $runtime, 2);
|
$reqs = number_format(1 / $runtime, 2);
|
||||||
|
|||||||
@@ -57,10 +57,11 @@ class Socket
|
|||||||
/**
|
/**
|
||||||
* 调试输出接口
|
* 调试输出接口
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $logs 日志信息
|
* @param Response $response Response对象
|
||||||
|
* @param array $log 日志信息
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function output(array $logs = [])
|
public function output(Response $response, array $log = [])
|
||||||
{
|
{
|
||||||
if (!$this->check()) {
|
if (!$this->check()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user