2018-05-02 10:35:38 +00:00
|
|
|
|
# Lumen 的sql记录组件
|
2018-05-02 09:56:08 +00:00
|
|
|
|
|
2018-05-02 11:30:51 +00:00
|
|
|
|
引入该组件后,如果 APP_DEBUG = true 时,会自动将sql执行日志记录到 storage/logs/sql-{Y-m-d}.log 中。默认只保留最近15天的日志
|
2018-05-02 10:39:32 +00:00
|
|
|
|
|
2018-05-02 10:35:38 +00:00
|
|
|
|
### 引入
|
|
|
|
|
```bash
|
|
|
|
|
composer config repositories.lumen-sql-logger vcs git@git.int.haowumc.com:arch/lumen-sql-logger.git
|
|
|
|
|
composer require --dev arch/lumen-sql-logger
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 开启
|
2018-05-02 10:27:30 +00:00
|
|
|
|
```php
|
|
|
|
|
if (env('APP_ENV') == 'local') {
|
2018-05-02 10:35:38 +00:00
|
|
|
|
$app->register(Arch\EventServiceProvider::class);
|
2018-05-02 10:27:30 +00:00
|
|
|
|
}
|
2018-05-02 10:35:38 +00:00
|
|
|
|
```
|
2018-05-02 10:27:30 +00:00
|
|
|
|
|
2018-05-02 10:35:38 +00:00
|
|
|
|
###配置
|
|
|
|
|
在.env中增加如下配置
|
|
|
|
|
```bash
|
|
|
|
|
APP_NAME = api
|
2018-05-02 10:27:30 +00:00
|
|
|
|
```
|
2018-05-02 10:35:38 +00:00
|
|
|
|
|