mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 08:34:39 -04:00
Move query logging into terminate method
This commit is contained in:
parent
df82f176d3
commit
d1a1ee55dc
@ -23,6 +23,7 @@ use Turbo124\Beacon\Facades\LightLogs;
|
|||||||
*/
|
*/
|
||||||
class QueryLogging
|
class QueryLogging
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
@ -33,6 +34,7 @@ class QueryLogging
|
|||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Enable query logging for development
|
// Enable query logging for development
|
||||||
if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
@ -45,8 +47,8 @@ class QueryLogging
|
|||||||
|
|
||||||
public function terminate($request, $response)
|
public function terminate($request, $response)
|
||||||
{
|
{
|
||||||
|
if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
||||||
$timeStart = microtime(true);
|
return;
|
||||||
|
|
||||||
// hide requests made by debugbar
|
// hide requests made by debugbar
|
||||||
if (strstr($request->url(), '_debugbar') === false) {
|
if (strstr($request->url(), '_debugbar') === false) {
|
||||||
@ -54,7 +56,7 @@ class QueryLogging
|
|||||||
$queries = DB::getQueryLog();
|
$queries = DB::getQueryLog();
|
||||||
$count = count($queries);
|
$count = count($queries);
|
||||||
$timeEnd = microtime(true);
|
$timeEnd = microtime(true);
|
||||||
$time = $timeEnd - $timeStart;
|
$time = $timeEnd - LARAVEL_START;
|
||||||
|
|
||||||
if ($count > 175) {
|
if ($count > 175) {
|
||||||
nlog("Query count = {$count}");
|
nlog("Query count = {$count}");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user