mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
增加app_trace 参数用于配置是否开启trace调试
This commit is contained in:
@@ -9,6 +9,8 @@ return [
|
||||
'app_namespace' => 'app',
|
||||
// 应用调试模式
|
||||
'app_debug' => true,
|
||||
// 应用Trace
|
||||
'app_trace' => false,
|
||||
// 应用模式状态
|
||||
'app_status' => '',
|
||||
// 是否支持多模块
|
||||
@@ -134,24 +136,26 @@ return [
|
||||
'error_message' => '页面错误!请稍后再试~',
|
||||
// 显示错误信息
|
||||
'show_error_msg' => false,
|
||||
// 异常处理handle类 留空使用 \think\exception\Handle
|
||||
'exception_handle' => '',
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 日志设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
'log' => [
|
||||
// 日志记录方式,支持 file sae
|
||||
// 日志记录方式,内置 file sae 支持扩展
|
||||
'type' => 'File',
|
||||
// 日志保存目录
|
||||
'path' => LOG_PATH,
|
||||
],
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Trace设置
|
||||
// | Trace设置 开启 app_trace 后 有效
|
||||
// +----------------------------------------------------------------------
|
||||
'trace' => [
|
||||
// 支持Html Socket Console 设为false则不显示
|
||||
'type' => false,
|
||||
// 内置Html Socket Console 支持扩展
|
||||
'type' => 'Html',
|
||||
],
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
@@ -245,6 +249,7 @@ return [
|
||||
// 自动写入时间戳字段
|
||||
'auto_timestamp' => false,
|
||||
],
|
||||
|
||||
//分页配置
|
||||
'paginate' => [
|
||||
'type' => 'bootstrap',
|
||||
|
||||
@@ -155,7 +155,9 @@ class App
|
||||
Hook::listen('app_end', $response);
|
||||
|
||||
// Trace调试注入
|
||||
if (Config::get('app_trace')) {
|
||||
Debug::inject($response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -188,8 +188,6 @@ class Debug
|
||||
{
|
||||
$config = Config::get('trace');
|
||||
$type = isset($config['type']) ? $config['type'] : 'Html';
|
||||
|
||||
if (false !== $type) {
|
||||
$request = Request::instance();
|
||||
$accept = $request->header('accept');
|
||||
$contentType = $response->getHeader('Content-Type');
|
||||
@@ -222,5 +220,4 @@ class Debug
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class Error
|
||||
if (error_reporting() & $errno) {
|
||||
// 将错误信息托管至 think\exception\ErrorException
|
||||
throw $exception;
|
||||
}else{
|
||||
} else {
|
||||
self::getExceptionHandler()->report($exception);
|
||||
}
|
||||
}
|
||||
@@ -98,24 +98,20 @@ class Error
|
||||
/**
|
||||
* Get an instance of the exception handler.
|
||||
*
|
||||
* @return \think\exception\Handle
|
||||
* @return Handle
|
||||
*/
|
||||
public static function getExceptionHandler()
|
||||
{
|
||||
static $handle;
|
||||
|
||||
if (!$handle) {
|
||||
|
||||
if ($class = Config::get('exception_handle')) {
|
||||
if (class_exists($class) && is_subclass_of($class, "\\think\\exception\\Handle")) {
|
||||
// 异常处理handle
|
||||
$class = Config::get('exception_handle');
|
||||
if ($class && class_exists($class) && is_subclass_of($class, "\\think\\exception\\Handle")) {
|
||||
$handle = new $class;
|
||||
} else {
|
||||
$handle = new Handle;
|
||||
}
|
||||
}
|
||||
if (!$handle) {
|
||||
$handle = new Handle();
|
||||
}
|
||||
}
|
||||
|
||||
return $handle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\exception\ClassNotFoundException;
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,7 @@ class Log
|
||||
$class = false !== strpos($type, '\\') ? $type : '\\think\\log\\driver\\' . ucwords($type);
|
||||
self::$config = $config;
|
||||
unset($config['type']);
|
||||
if(class_exists($class)) {
|
||||
if (class_exists($class)) {
|
||||
self::$driver = new $class($config);
|
||||
} else {
|
||||
throw new ClassNotFoundException('class not exists:' . $class, $class);
|
||||
@@ -110,7 +111,6 @@ class Log
|
||||
*/
|
||||
public static function check($config)
|
||||
{
|
||||
|
||||
if (self::$key && !empty($config['allow_key']) && !in_array(self::$key, $config['allow_key'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user