samuelerwardi / lumeninterceptor
There is no license information available for the latest version (1.0.6) of this package.
This library for write log using intercept request and response middleware
1.0.6
2022-03-03 13:20 UTC
Requires
- php: ^7.2
- ext-json: *
- fzaninotto/faker: ^1.9
- guzzlehttp/guzzle: ^6.5
- http-interop/http-factory-guzzle: ^1.0
- lcobucci/jwt: ^3.3
- symfony/psr-http-message-bridge: ^2.0
README
This library for write log using intercept request and response middleware
Installation
Use [Composer] to install the package:
$ composer require yannice92/lumeninterceptor
Note
Make sure if you using php-fpm, add log_limit = 100000
on your php-fpm pool, to prevent multiline output on stdout
Usage
- Change extended class in app/Exceptions/Handler.php from
Laravel\Lumen\Exceptions\Handler as ExceptionHandler
withuse Yannice92\LumenInterceptor\Exceptions\BaseHandler;
so it should beclass Handler extends BaseHandler
- Add
Yannice92\LumenInterceptor\Http\Middleware\LogRequestResponseMiddleware::class
in global middleware on bootstrap/app.php$app->middleware([ Yannice92\LumenInterceptor\Http\Middleware\LogRequestResponseMiddleware::class, ... ]);
- Add
X-Request-ID
header for correlation Id - Add config/logging.php
'stdout' => [ 'driver' => 'monolog', 'level' => 'info', 'handler' => StreamHandler::class, 'with' => [ 'stream' => 'php://stdout', ], 'formatter' => \Yannice92\LumenInterceptor\Logging\JsonFormatter::class, ],