mitoop/laravel-query-logger

v1.0.2 2024-05-27 07:57 UTC

This package is auto-updated.

Last update: 2024-10-27 08:51:51 UTC


README

🍎 记录 SQL 执行日志

安装

composer require --dev mitoop/laravel-query-logger

配置

config/logging.php 新增配置

<?php

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

    // 新增 query
    'query' => [
         // 是否开启记录
        'enabled' => env('ENABLE_QUERY_LOG', false),
         // 记录的频道
        'channel' => 'sql'
    ]
];