PHP code example of mitoop / laravel-query-logger

1. Go to this page and download the library: Download mitoop/laravel-query-logger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mitoop / laravel-query-logger example snippets




return [
    'channels' => [
        ...        
        'sql' => [
            'driver' => 'daily',
            'path' => storage_path('logs/sql.log'),
            'level' => env('LOG_LEVEL', 'debug'),
            'permission' => 0664,
        ],
    ],

    // 增加配置
    'query' => [
        'enabled' => env('ENABLE_QUERY_LOG', false), // [总开关] 是否开启 SQL 查询日志记录
        'channel' => 'sql' // 选择日志记录的频道
    ]
];

public function register()
{
    \Mitoop\LaravelQueryLogger\Condition::using(function () {
        return true; // 自定义触发条件
    });
}