sunaoka/laravel-query-logger
最新稳定版本:v2.1.2
Composer 安装命令:
composer require --dev sunaoka/laravel-query-logger
包简介
Query logger for Laravel.
README 文档
README
Support Policy
| Version (*1) | Laravel (*2) | PHP (*3) |
|---|---|---|
| 1 | 5.7 - 11 | 7.1 - 8.3 |
| 2 | 10.15 - 12 | 8.1 - 8.5 |
(*1) Supported Query logger version
(*2) Supported Laravel versions
(*3) Supported PHP versions
Installation
composer require --dev sunaoka/laravel-query-logger
Configurations
php artisan vendor:publish --tag=query-logger-config
<?php declare(strict_types=1); return [ /* |-------------------------------------------------------------------------- | Output Log Color |-------------------------------------------------------------------------- | | Sets the foreground and background colors of the log output. | | Supported: "black", "red", "green", "yellow", "blue", "magenta", "cyan", | "white", "default", "gray", "bright-red", "bright-green", | "bright-yellow", "bright-blue", "bright-magenta", | "bright-cyan", "bright-white" */ 'color' => [ 'foreground' => env('QUERY_LOGGER_COLOR_FOREGROUND', ''), 'background' => env('QUERY_LOGGER_COLOR_BACKGROUND', ''), ], /* |-------------------------------------------------------------------------- | Slow Query Log |-------------------------------------------------------------------------- | | Sets the number of milliseconds to output the slow query. | If less than 0 is specified, all logs are output. */ 'slow_query' => [ 'milliseconds' => (int) env('QUERY_LOGGER_SLOW_QUERY_MILLISECONDS', 0), ], ];
Usage
<?php \DB::beginTransaction(); \App\User::whereEmail('example@example.com')->update(['name' => 'example']); \DB::commit(); \DB::beginTransaction(); \App\User::whereEmail('example@example.com')->update(['name' => 'example']); \DB::rollBack();
tail -F storage/logs/laravel.log
[2020-09-11 01:08:37] local.DEBUG: BEGIN; [2020-09-11 01:08:37] local.DEBUG: [0.31ms] update "users" set "name" = 'example' where "email" = 'example@example.com'; [2020-09-11 01:08:37] local.DEBUG: COMMIT; [2020-09-11 01:08:37] local.DEBUG: BEGIN; [2020-09-11 01:08:37] local.DEBUG: [0.12ms] update "users" set "name" = 'example' where "email" = 'example@example.com'; [2020-09-11 01:08:37] local.DEBUG: ROLLBACK;
统计信息
- 总下载量: 918
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-13