You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Drop Laravel 9 support, require Laravel v10.15 or higher for the new [`DB::getRawQueryLog()`](https://github.com/laravel/framework/pull/47507) support.
10
+
- PHP code style fixes by `laravel/pint` v1.10, now using more strict style rules (`laravel` preset).
11
+
- Refactored whole codebase from `DB::getQueryLog()` to use the new `DB::getRawQueryLog()` method, so `ReplacesBindings` is no longer needed.
12
+
- Replaced [torann/geoip](https://github.com/Torann/laravel-geoip) by [stevebauman/location](https://github.com/stevebauman/location) for optional GeoIP support.
13
+
- Improved username detection in `Formatter` headers, so that it works both with default `email` field or custom `username()` method on `User` model.
Copy file name to clipboardExpand all lines: README.md
+13-14Lines changed: 13 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
This module allows you to log SQL queries to log file in Laravel framework. It's useful mainly
10
10
when developing your application to verify whether your queries are valid and to make sure your application doesn't run too many or too slow database queries.
11
11
12
-
You may also use this in production as it should not cause a lot of overhead. Logged queries can be limited by query pattern, and logging only occurs at the end of each request or artisan command execution.
12
+
You may also use this in production as it should not cause a lot of overhead. Logged queries can be limited by query pattern, and logging only occurs at the end of each request or artisan command execution, not per query execution.
13
13
14
14
It reports a lot of metadata like total query count, total execution time, origin (request URL/console command), authenticated user, app environment, client browser agent / IP / hostname.
15
15
@@ -22,9 +22,9 @@ It reports a lot of metadata like total query count, total execution time, origi
22
22
in console to install this module (Notice `--dev` flag - it's recommended to use this package only for development).
23
23
24
24
Laravel uses package auto-discovery, and it will automatically load this service provider, so you don't need to add anything into the `providers` section of `config/app.php`.
25
-
25
+
26
26
2. Run the following in your console to publish the default configuration file:
If you have also `.env.example` it's recommended to add those entries also in `.env.example` file just to make sure everyone knows about those env variables. Be aware that `SQL_REPORTER_DIRECTORY` is directory inside storage directory.
62
-
62
+
63
63
To find out more about those setting please take a look at [Configuration file](config/sql-reporter.php)
64
-
64
+
65
65
4. Make sure directory specified in `.env` file exists in storage path, and you have valid permissions to create and modify files in this directory (If it does not exist this package will automatically create it when needed, but it's recommended to create it manually with valid file permissions)
66
66
67
67
5. Make sure on live server you will set logging SQL queries to falsein your `.env` file: `SQL_REPORTER_QUERIES_ENABLED=false`. This package is recommended to be used only for development to not impact production application performance.
68
68
69
69
## Optional
70
70
71
-
For optional GeoIP support (adding country information to client IP in log headers), you may install [torann/geoip](https://github.com/Torann/laravel-geoip) in your project:
71
+
For optional GeoIP support (adding country information to client IP in log headers), you may install [stevebauman/location](https://github.com/stevebauman/location) in your project:
It will be auto-detected, no configuration needed for this.
78
+
It will be auto-detected, no configuration needed for this. If you wish to use a different driver than the default [IpApi](https://ip-api.com/), e.g. `MaxMind` make sure you correctly configure it according to the docs: [Available Drivers](https://github.com/stevebauman/location#available-drivers)
79
79
80
80
## Development
81
81
@@ -100,7 +100,7 @@ This package was inspired by [mnabialek/laravel-sql-logger](https://github.com/m
100
100
101
101
- Query logging is not triggered upon each query execution but instead at a final step, using `RequestHandled` and `CommandFinished` events.
102
102
- This allows us to include much more information about the whole query executions like total query count, total execution time, and very detailed header information like origin (request URL/console command), authenticated user, app environment, client browser agent / IP / hostname.
103
-
- This package is greatly simplified and only provides support for Laravel 8+ / PHP 8
103
+
- This package is greatly simplified and only provides support for Laravel 10 / PHP 8.1+
104
104
- It uses the Laravel built-in query logging (`DB::enableQueryLog()`) which logs all queries in memory, which should perform much better than writing every single query to the log file.
105
105
- By default, `onlime/laravel-sql-reporter` produces much nicer log output, especially since we only write header information before the first query.
106
106
@@ -153,12 +153,11 @@ All changes are listed in [CHANGELOG](CHANGELOG.md)
153
153
- If your application crashes, this package will not log any queries, as logging is only triggered at the end. As alternative, you could use [mnabialek/laravel-sql-logger](https://github.com/mnabialek/laravel-sql-logger) which triggers sql logging on each query execution.
154
154
- It's currently not possible to log slow queries into a separate logfile. I wanted to keep that package simpel.
155
155
156
-
## Todo
156
+
## TODO
157
157
158
158
- [ ] Improve unit testing to reach 100% coverage
159
159
- [ ] Integrate Coveralls.io and add test coverage status badge to README
160
-
- [ ] Add browser type information to log headers, using hisorange/browser-detect
161
-
- [ ] Support for Lumen
160
+
- [ ] Add browser type information to log headers, maybe using [hisorange/browser-detect](https://github.com/hisorange/browser-detect)
0 commit comments