beyondcode/laravel-query-detector

Log Output

HDVinnie opened this issue · 2 comments

Hello,

This is a very interesting package and I thank you for it to start off. I do have a question regarding the Log outputs.

I enabled the package and my config looks like so. My Laravel logs were empty.


<?php

return [
    /*
     * Enable or disable the query detection.
     * If this is set to "null", the app.debug config value will be used.
     */
    'enabled' => env('QUERY_DETECTOR_ENABLED', true),

    /*
     * Here you can whitelist model relations.
     *
     * Right now, you need to define the model relation both as the class name and the attribute name on the model.
     * So if an "Author" model would have a "posts" relation that points to a "Post" class, you need to add both
     * the "posts" attribute and the "Post::class", since the relation can get resolved in multiple ways.
     */
    'except' => [
        //Author::class => [
        //    Post::class,
        //    'posts',
        //]
    ],

    /*
     * Define the output formats that you want to use.
     * Available options are:
     *
     * Alert:
     * Displays an alert on the website
     * \BeyondCode\QueryDetector\Outputs\Alert::class
     *
     * Debugbar: (make sure you have the barryvdh/laravel-debugbar package installed)
     * Writes the N+1 queries into a custom messages collector of Debugbar
     * \BeyondCode\QueryDetector\Outputs\Debugbar::class
     *
     * Log:
     * Writes the N+1 queries into the Laravel.log file
     * \BeyondCode\QueryDetector\Outputs\Log::class
     */
    'output' => [
        \BeyondCode\QueryDetector\Outputs\Log::class,
       // \BeyondCode\QueryDetector\Outputs\Alert::class,
    ]
];

Immediately after turning enabled to true my logs started flooding with info leveled entries.

For starters I thought the N+1 entries would be at a warning level and not info. Also is it really nessisary that it logs all this info entries for Pipeline, Routing and Middleware?

Am I misunderstanding something here?

https://imgur.com/l9lX1SM

@HDVinnie sorry this is not related but out of curiosity, which package are you using for viewing logs ? it looks nice.