Skip to content

Commit c91777b

Browse files
committed
Initial Commit
0 parents  commit c91777b

File tree

8 files changed

+618
-0
lines changed

8 files changed

+618
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) <Keyur Ajmera>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

composer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "klaravel/db-logger",
3+
"description": "Laravel database/sql queries logger.",
4+
"license": "MIT",
5+
"keywords": ["laravel", "sql", "db", "log", "logger", "db-logger", "sql-logger"],
6+
"authors": [
7+
{
8+
"name": "Keyur Ajmera",
9+
"email": "ajmerainfo@gmail.com"
10+
}
11+
],
12+
"require": {
13+
"illuminate/support": "5.*"
14+
},
15+
"autoload": {
16+
"psr-4": {
17+
"Klaravel\\DbLogger\\": "src/"
18+
}
19+
},
20+
"minimum-stability": "dev"
21+
}

composer.lock

Lines changed: 233 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Database Queries Logger for Laravel 5.3+
2+
3+
This module allows you to log SQL queries (and slow SQL queries) to log file in Laravel framework. It's useful mainly
4+
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.
5+
6+
### Installation
7+
8+
1. Run
9+
```php
10+
composer require klaravel/db-logger
11+
```
12+
in console to install this module
13+
14+
2. Open `config/app.php` and in `providers` section add:
15+
16+
```php
17+
Klaravel\DbLogger\ServiceProvider::class,
18+
```
19+
20+
3. Run:
21+
22+
```php
23+
php artisan vendor:publish --provider="Klaravel\DbLogger\ServiceProvider"
24+
```
25+
26+
in your console to publish default configuration files
27+
28+
4. Open `config/dblogger.php` file and adjust settings to your need (by default it uses `.env` file so you can skip this step if you want).
29+
30+
5. In your .env file add the following entries:
31+
32+
```
33+
DB_LOG_QUERIES=true # if not needed make it false
34+
DB_LOG_SLOW_QUERIES=true # if not needed make it false
35+
DB_SLOW_QUERIES_MIN_EXEC_TIME=100
36+
DB_LOG_OVERRIDE=false
37+
DB_LOG_DIRECTORY=logs/db
38+
DB_CONVERT_TIME_TO_SECONDS=false
39+
DB_LOG_SEPARATE_ARTISAN=false
40+
```
41+
42+
and adjust values to your needs. If you have also `.env.sample` it's also recommended to add those entries also in `.env.sample` file just to make sure everyone know about those env variables. Be aware that `DB_LOG_DIRECTORY` is directory inside storage directory. If you want you can change it editing `config/dblogger.php` file.

0 commit comments

Comments
 (0)