-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
101 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":206:{a:2:{s:7:"defects";a:1:{s:67:"Sdkcodes\Logpress\Tests\RequestLoggingTest::testRequestWrittenToLog";i:3;}s:5:"times";a:1:{s:67:"Sdkcodes\Logpress\Tests\RequestLoggingTest::testRequestWrittenToLog";d:0.169;}}} | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":246:{a:2:{s:7:"defects";a:2:{s:67:"Sdkcodes\Logpress\Tests\RequestLoggingTest::testRequestWrittenToLog";i:3;s:7:"Warning";i:6;}s:5:"times";a:2:{s:67:"Sdkcodes\Logpress\Tests\RequestLoggingTest::testRequestWrittenToLog";d:0.165;s:7:"Warning";d:0.001;}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
MIT License | ||
|
||
Copyright (c) 2020 Pine | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
> ### Log requests coming into your laravel app | ||
Helps you know exactly what comes in and when. The package will log all query and body parameters attached to a request. | ||
|
||
---------- | ||
|
||
# Getting started | ||
|
||
## Installation | ||
|
||
Install this package via composer | ||
|
||
```$ composer require sdkcodes/logpress``` | ||
|
||
|
||
## Middleware Usage | ||
|
||
** The package comes with a middleware that you can apply either to only the routes you want to log, or all routes. | ||
|
||
The middleware lives in the namespace: | ||
|
||
`use Sdkcodes\Logpress\Middleware\LogRequests;` | ||
|
||
Open your `App\Http\Kernel.php` | ||
|
||
To log request to all routes, add the LogRequests api to the `$middleware` array: | ||
``` | ||
protected $middleware = [ | ||
\App\Http\Middleware\TrustProxies::class, | ||
\Fruitcake\Cors\HandleCors::class, | ||
\App\Http\Middleware\CheckForMaintenanceMode::class, | ||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, | ||
\App\Http\Middleware\TrimStrings::class, | ||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, | ||
LogRequests::class | ||
]; | ||
``` | ||
|
||
Or you can add to specific middleware groups `$middlewareGroups` array e.g 'web' or 'api'. | ||
|
||
Or add to the `$routeMiddleware` array to apply on a route by route basis. | ||
|
||
|
||
## Configuration | ||
|
||
By default, the package 'avoids' logging fields with the name 'password' or 'pin', however, you can overwrite these values by publishing the config file and updating the 'avoids' | ||
|
||
`λ php artisan vendor:publish --provider="Sdkcodes\Logpress\LogpressServiceProvider" --tag=config` | ||
|
||
This command publishes a new config file 'logpress.php' to your config directory and you can modify to include all the fields you want to avoid logging. | ||
|
||
## Output | ||
|
||
The output generated looks like: | ||
|
||
`[2020-04-25 16:42:17] local.INFO: GET / - Body: {"q":"artisan","person":"goodluck"} Query: {"q":"artisan","person":"goodluck"} Full path: http://laravelpackagedev.sdk Scheme: http` | ||
|
||
## LICENSE | ||
The MIT License (MIT). Please see [License File](LICENSE) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters