Skip to content

Commit 0dad79b

Browse files
authored
Merge pull request #9 from bolechen/master
Laravel Query Logger will be enabled when is & some fix
2 parents 996bdea + 2043b2c commit 0dad79b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.php_cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
$header = <<<EOF
3-
This file is part of the overtrue/package-builder.
3+
This file is part of the overtrue/laravel-query-logger.
44
55
(c) overtrue <i@overtrue.me>
66

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@
88
$ composer require overtrue/laravel-query-logger --dev -vvv
99
```
1010

11-
> Plz keep the `--dev` option.
11+
Laravel Query Logger will be enabled when `APP_DEBUG` is `true`.
12+
13+
> Please keep the `--dev` option.
1214
1315
## Usage
1416

1517
```shell
1618
$ tail -f ./storage/logs/laravel.log
1719
```
1820

19-
[2017-09-05 14:52:13] local.INFO: ============ URL: http://laravel.app/discussions ===============
20-
[2017-09-05 14:52:14] local.DEBUG: [800μs] select count(*) as aggregate from `discussions` where `discussions`.`deleted_at` is null
21-
[2017-09-05 14:52:14] local.DEBUG: [1.07ms] select * from `discussions` where `discussions`.`deleted_at` is null order by `is_top` desc, `created_at` desc limit 15 offset 0
22-
[2017-09-05 14:52:14] local.DEBUG: [3.63s] select `tags`.*, `taggables`.`taggable_id` as `pivot_taggable_id`, `taggables`.`tag_id` as `pivot_tag_id` from `tags` inner join `taggables` on `tags`.`id` = `taggables`.`tag_id` where `taggables`.`taggable_id` in ('1', '2', '3', '4', '5', '6', '7', '8') and `taggables`.`taggable_type` = 'App\\Models\\Discussion' order by `order_column` asc
23-
[2017-09-05 14:52:14] local.DEBUG: [670μs] select * from `users` where `users`.`id` in ('1', '2', '4') and `users`.`deleted_at` is null
21+
[2017-09-05 14:52:14] local.DEBUG: [800μs] select count(*) as aggregate from `discussions` where `discussions`.`deleted_at` is null | GET: http://laravel.app/discussions
22+
[2017-09-05 14:52:14] local.DEBUG: [1.07ms] select * from `discussions` where `discussions`.`deleted_at` is null order by `is_top` desc, `created_at` desc limit 15 offset 0 | GET: http://laravel.app/discussions
23+
[2017-09-05 14:52:14] local.DEBUG: [3.63s] select `tags`.*, `taggables`.`taggable_id` as `pivot_taggable_id`, `taggables`.`tag_id` as `pivot_tag_id` from `tags` inner join `taggables` on `tags`.`id` = `taggables`.`tag_id` where `taggables`.`taggable_id` in ('1', '2', '3', '4', '5', '6', '7', '8') and `taggables`.`taggable_type` = 'App\\Models\\Discussion' order by `order_column` asc | GET: http://laravel.app/discussions
24+
[2017-09-05 14:52:14] local.DEBUG: [670μs] select * from `users` where `users`.`id` in ('1', '2', '4') and `users`.`deleted_at` is null | GET: http://laravel.app/discussions
2425
...
26+
2527
## License
2628

27-
MIT
29+
MIT

src/ServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ServiceProvider extends LaravelServiceProvider
2323
*/
2424
public function boot()
2525
{
26-
if (isset($_SERVER['QUERY_LOGGER_ENABLED']) && !$_SERVER['QUERY_LOGGER_ENABLED']) {
26+
if (!$this->app['config']->get('app.debug')) {
2727
return;
2828
}
2929

0 commit comments

Comments
 (0)