celysium/logger

There is no license information available for the latest version (v1.24) of this package.

v1.24 2023-12-03 06:25 UTC

This package is auto-updated.

Last update: 2024-05-03 07:30:31 UTC


README

Log Http Request,Response,Exception

for store http request and response into collection request_log in mongo db use macro loggable

before:

Http::withBasicAuth(env('USERNAME'), env('PASSWORD'))            
            ->withHeaders(
                [
                    'Accept'           => 'application/json',
                    'Content-Type'     => 'application/json',
                ]
            )
            ->baseUrl(env('BASE_URL'))
            ->get('')
            ->onError(function ($response) {
                throw new BadRequestHttpException($response);
            })
            ->json();

after:

Http::loggable('name')->withBasicAuth(env('USERNAME'), env('PASSWORD'))            
            ->withHeaders(
                [
                    'Accept'           => 'application/json',
                    'Content-Type'     => 'application/json',
                ]
            )
            ->baseUrl(env('BASE_URL'))
            ->get('')
            ->onError(function ($response) {
                throw new BadRequestHttpException($response);
            })
            ->json();