Skip to content

Add new on-demand configuration #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2021
Merged

Conversation

bilfeldt
Copy link
Owner

@bilfeldt bilfeldt commented Apr 5, 2021

This PR adds an extra $config parameter to HttpLoggerInterface, HttpLoggingFilterInterface and the two macros log and logWhen.

The purpose of this PR is to make it possible to specify configuration on demand.

Example

The default configuration is to log only request/responses with errors

// config/http-client-logger.php
'filtering' => [
    'always' => false,
    '2xx' => false,
    '3xx' => false,
    '4xx' => true,
    '5xx' => true
],

with this PR is now possible to log just one request/response to say a specific disk:

$config = [
    'filtering' => [
        'always' => true,
    ],
    'log_to_disk' => [
        'enabled' => true,
        'disk' => 'local',
    ],
];
Http::log([], $config)->get(....);

@bilfeldt bilfeldt self-assigned this Apr 5, 2021
@bilfeldt bilfeldt merged commit 954cd0f into master Apr 5, 2021
@bilfeldt bilfeldt deleted the feature/on-demand-config branch April 5, 2021 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant