diff --git a/aws_config.go b/aws_config.go index f63c8622..b53fac62 100644 --- a/aws_config.go +++ b/aws_config.go @@ -173,8 +173,14 @@ func commonLoadOptions(c *Config) ([]func(*config.LoadOptions) error, error) { config.WithRegion(c.Region), config.WithHTTPClient(httpClient), config.WithAPIOptions(apiOptions), - config.WithClientLogMode(aws.LogRequestWithBody | aws.LogResponseWithBody | aws.LogRetries), - config.WithLogger(debugLogger{}), + } + + if !c.SuppressDebugLog { + loadOptions = append( + loadOptions, + config.WithClientLogMode(aws.LogRequestWithBody|aws.LogResponseWithBody|aws.LogRetries), + config.WithLogger(debugLogger{}), + ) } sharedCredentialsFiles, err := c.ResolveSharedCredentialsFiles() diff --git a/internal/config/config.go b/internal/config/config.go index 79a026b7..cb257064 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -32,6 +32,7 @@ type Config struct { SkipRequestingAccountId bool StsEndpoint string StsRegion string + SuppressDebugLog bool Token string UseDualStackEndpoint bool UseFIPSEndpoint bool diff --git a/v2/awsv1shim/session.go b/v2/awsv1shim/session.go index f375dc26..ca415db3 100644 --- a/v2/awsv1shim/session.go +++ b/v2/awsv1shim/session.go @@ -40,8 +40,6 @@ func getSessionOptions(awsC *awsv2.Config, c *awsbase.Config) (*session.Options, Config: aws.Config{ Credentials: newV2Credentials(awsC.Credentials), HTTPClient: httpClient, - LogLevel: aws.LogLevel(aws.LogDebugWithHTTPBody | aws.LogDebugWithRequestRetries | aws.LogDebugWithRequestErrors), - Logger: debugLogger{}, MaxRetries: aws.Int(0), Region: aws.String(awsC.Region), UseFIPSEndpoint: convertFIPSEndpointState(useFIPSEndpoint), @@ -49,6 +47,11 @@ func getSessionOptions(awsC *awsv2.Config, c *awsbase.Config) (*session.Options, }, } + if !c.SuppressDebugLog { + options.Config.LogLevel = aws.LogLevel(aws.LogDebugWithHTTPBody | aws.LogDebugWithRequestRetries | aws.LogDebugWithRequestErrors) + options.Config.Logger = debugLogger{} + } + // We can't reuse the io.Reader from the awsv2.Config, because it's already been read. // Re-create it here from the filename. if c.CustomCABundle != "" {