Completed
Push — master ( 488797...ae2a4f )
by Marcel
10s
created

Log::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BeyondCode\QueryDetector\Outputs;
4
5
use Log as LaravelLog;
6
use Illuminate\Support\Collection;
7
use Symfony\Component\HttpFoundation\Response;
8
9
class Log implements Output
10
{
11
    public function boot()
12
    {
13
        //
14
    }
15
16
    public function output(Collection $detectedQueries, Response $response)
17
    {
18
        LaravelLog::info('Detected N+1 Query');
19
        foreach ($detectedQueries as $detectedQuery) {
20
            LaravelLog::info('Model: '.$detectedQuery['model']);
21
            LaravelLog::info('Relation: '.$detectedQuery['relation']);
22
            LaravelLog::info('Num-Called: '.$detectedQuery['count']);
23
24
            LaravelLog::info('Call-Stack:');
25
26
            foreach ($detectedQuery['sources'] as $source) {
27
                LaravelLog::info('#'.$source->index.' '.$source->name.':'.$source->line);
28
            }
29
        }
30
    }
31
}
32