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

aws/client: Fix logging to allow it to be enabled per operation #3778

Merged
merged 3 commits into from
Feb 16, 2021

Conversation

jasdel
Copy link
Contributor

@jasdel jasdel commented Feb 10, 2021

Allow logging of operation and request to be enabled per operation, not only per client or session.

	client := dynamodb.New(sess)

	var w bytes.Buffer
	resp, err := client.DescribeTableWithContext(context.TODO(), params,
		func(r *request.Request) {
			r.Config.LogLevel = aws.LogLevel(aws.LogDebugWithHTTPBody)
			r.Config.Logger = aws.LoggerFunc(func(args ...interface{}) {
				fmt.Fprintln(&w, args...)
			})
		})
	if someCondition {
		log.Printf("Condition met\n%s", w.String())
	}

@skotambkar
Copy link
Contributor

need to fix failing tests

Allow logging of operation and request to be enabled per operation, not
only per client or session.

	client := dynamodb.New(sess)

	var w bytes.Buffer
	resp, err := client.DescribeTableWithContext(context.TODO(), params,
		func(r *request.Request) {
			r.Config.LogLevel = aws.LogLevel(aws.LogDebugWithHTTPBody)
			r.Config.Logger = aws.LoggerFunc(func(args ...interface{}) {
				fmt.Fprintln(&w, args...)
			})
		})
	if someCondition {
		log.Printf("Condition met\n%s", w.String())
	}
@jasdel jasdel merged commit 606788c into aws:master Feb 16, 2021
@jasdel jasdel deleted the fixup/PerOpLogging branch February 16, 2021 00:36
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.

3 participants