-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
public function handle($request, Closure $next)
{
$debug = $this->app->isDebug();
// 注册日志监听
if ($debug) {
$this->log = [];
$this->app->event->listen(LogWrite::class, function ($event) {
if (empty($this->config['channel']) || $this->config['channel'] == $event->channel) {
$this->log = array_merge_recursive($this->log, $event->log);
}
});
}
$response = $next($request);
// Trace调试注入
if ($debug) { //这里的判断,还是读取的最初的值,无法在其他中间件或控制器中,改变此属性
$data = $response->getContent();
$this->traceDebug($response, $data);
$response->content($data);
}
return $response;
}
Metadata
Metadata
Assignees
Labels
No labels