Skip to content
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

Log response when there is a 3XX/4XX/5XX error #397

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

gcatanese
Copy link
Contributor

Summary

This PR adds 3 additional configuration flags to enable logging when an error occurs:

    // when true logs 3XX errors on stdout
    Log3XXError           bool              `json:"debug,omitempty"`
    // when true logs 4XX errors on stdout
    Log4XXError           bool              `json:"debug,omitempty"`
    // when true logs 5XX errors on stdout
    Log5XXError           bool              `json:"debug,omitempty"`

Extra logging can be enabled to make sure the responses are logged when a given status code is returned

client := adyen.NewClient(&common.Config{
ApiKey:      "your api key",
Environment: common.TestEnv,
Log3XXError: true,
Log4XXError: true,
Log5XXError: true,
})

service := client.Checkout()

Fix #324

Tested scenarios

Added integration testing to confirm logging is performed.

@gcatanese gcatanese requested a review from a team as a code owner December 9, 2024 16:05
Copy link

sonarqubecloud bot commented Dec 9, 2024

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.

Dump Request/Response On HTTP Response Code >= 300
1 participant