dipenparmar12 / laravel-query-log
一个用于在用户定义的日志通道中记录查询的Laravel包。您所有的查询都将保存在日志文件中,您可以在任何时候查看它。
1.0.0
2020-07-18 11:58 UTC
Requires
- php: ^7.1
This package is auto-updated.
Last update: 2024-09-29 05:49:32 UTC
README
一个用于在用户定义的日志通道中记录查询的Laravel包。您所有的查询都将保存在日志文件中,您可以在任何时候查看它。
安装
通过composer安装此包
composer require dipenparmar12/laravel-query-log
注意:请确保仅在此包在开发环境中使用,否则在生产环境中可能会遇到性能下降。
可选地,您可以使用以下命令发布此包的配置文件
php artisan vendor:publish --provider="Dipenparmar12\QueryLog\StoreQueryLogServiceProvider" --tag="config"
以下配置文件将发布到 config/querylog.php
<?php return [ /* |-------------------------------------------------------------------------- | Default Log Channels |-------------------------------------------------------------------------- | | Here you may configure the log channels for query log. | This option defines the default log channel that gets used when writing | Query to the logs. The name specified in this option should match | one of the channels defined in the `config/logging.php` "channels" configuration array. | You can define multiple channels seprated by comman (,) for query log. | */ 'log_chhanels' => env('QUERY_LOG_CHHANELS', null), /* |-------------------------------------------------------------------------- | To disable or enable the general query log. |-------------------------------------------------------------------------- | | This option use to disable or enable the general query log, | Out of the box, Laravel uses the Monolog PHP logging library. | This gives you a variety of powerful log handlers / formatters | to utilize. | */ 'query_log_enable' => env('QUERY_LOG_ENABLE', true), ];
使用方法
如果您想完全禁用查询日志,请更改 .env
文件中的以下内容
QUERY_LOG_ENABLE=false
如果我们想在多个日志通道中使用查询日志,可以通过以下 .env
实现
QUERY_LOG_CHHANELS='single,daily'
注意:请确保此选项中指定的名称应与
config/logging.php
中定义的 channels 配置数组中的一个通道匹配。
变更日志
请参阅 CHANGELOG 了解最近更改的详细信息。
贡献
请参阅 CONTRIBUTING 了解详细信息。
安全
如果您发现任何安全相关的问题,请通过电子邮件 dipenparmar12@gmail.com 而不是使用问题跟踪器。
鸣谢
许可证
MIT许可证(MIT)。请参阅 许可证文件 了解更多信息。