aws / aws-sdk-php-symfony

Apache License 2.0
350 stars 89 forks source link

configure guzzle logger #69

Closed Nemo64 closed 1 year ago

Nemo64 commented 4 years ago

Is this related to a problem?

If you use this bundle, nothing will be logged.

Feature description

I'd like the to configure guzzles logger by default.

Describe alternatives you've considered

You can configure it but it isn't too obvious:

aws:
    version: latest
    region: '%env(AWS_REGION)%'
    http:
        handler: '@aws.http_handler'

services:
    aws.http_handler:
        class: GuzzleHttp\HandlerStack
        factory: [GuzzleHttp\HandlerStack, create]
        calls:
            - [push, ['@aws.http_logger']]

    aws.http_logger:
        class: Closure
        factory: [GuzzleHttp\Middleware, log]
        arguments:
            - '@logger'
            - '@aws.log_formatter'
        tags:
            - {name: monolog.logger, channel: aws}

    aws.log_formatter:
        class: GuzzleHttp\MessageFormatter
        arguments:
            - '{method} {uri} HTTP/{version} {code}'

This configuration doesn't validate though as the handler option isn't defined here.

You can also the 8p/EightPointsGuzzleBundle and configure the http_handler option (don't confuse it with the http.handler option from above) to pass a preconfigured Guzzle instance.

github-actions[bot] commented 1 year ago

We have noticed this issue has not recieved attention in 3 years. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.