<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Monitor; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Log; use ModStart\Core\Events\ModStartRequestHandled; use ModStart\Core\Util\ArrayUtil; use ModStart\Core\Util\EventUtil; class HttpMonitor { public static function init() { goto Uaxus; l01LW: Event::listen($FK2EG, function ($T9CQQ = null, $Lq983 = null) use($FK2EG) { if (!defined('LARAVEL_START')) { return; } $RDnT0 = $T9CQQ; if ($FK2EG == 'kernel.handled') { } else { $RDnT0 = $T9CQQ->request; $Lq983 = $T9CQQ->response; } $Zco5P = round((microtime(true) - LARAVEL_START) * 1000, 2); $XVqXz = $RDnT0->url(); $eNE35 = $RDnT0->method(); if (class_exists('\\ModStart\\Core\\Events\\ModStartRequestHandled')) { goto w8dP0; kMfof: EventUtil::fire($GrUf4); goto bRdZV; Tgq88: $GrUf4->method = $eNE35; goto TdLaw; w8dP0: $GrUf4 = new ModStartRequestHandled(); goto gcyfM; TdLaw: $GrUf4->time = $Zco5P; goto gYC8g; mpV7C: $GrUf4->response = $Lq983; goto tKX20; gcyfM: $GrUf4->url = $RDnT0->path(); goto Tgq88; gYC8g: $GrUf4->statusCode = 0; goto mpV7C; tKX20: if (method_exists($Lq983, 'status')) { $GrUf4->statusCode = $Lq983->status(); } else { if (method_exists($Lq983, 'getStatusCode')) { $GrUf4->statusCode = $Lq983->getStatusCode(); } } goto kMfof; bRdZV: } if (!config('modstart.trackPerformance', false)) { return; } $SmR_S = DatabaseMonitor::getQueryCountPerRequest(); $pmJAc = '{}'; if ($Zco5P > 5000 || $SmR_S > 30) { $pmJAc = ArrayUtil::serializeForLog($RDnT0->input()); } if ($Zco5P > 5000) { Log::warning("LONG_REQUEST {$eNE35} [{$XVqXz}] {$Zco5P}ms {$pmJAc}"); } if ($SmR_S > 30) { Log::warning("MASS_REQUEST_SQL {$eNE35} [{$XVqXz}] {$SmR_S} {$pmJAc} -> " . json_encode(DatabaseMonitor::getQueryCountPerRequestSqls(), JSON_UNESCAPED_UNICODE)); } }); goto eEdpe; HPrAe: if (class_exists('Illuminate\\Foundation\\Http\\Events\\RequestHandled')) { $FK2EG = 'Illuminate\\Foundation\\Http\\Events\\RequestHandled'; } goto l01LW; Uaxus: $FK2EG = 'kernel.handled'; goto HPrAe; eEdpe: } }